How to import all fields of my GML file

How to import all fields of my GML file

patrickvanhoeijen
Contributor Contributor
5,220 Views
43 Replies
Message 1 of 44

How to import all fields of my GML file

patrickvanhoeijen
Contributor
Contributor

I have this GML file attached ( I renamed to txt as I could not upload GML). I try to import this in Autocad map via Mapimport>GML. Some of the data I cannot import, I am interested in these fields/values for example to display as labels/texts:

<oz:kadastraleAanduiding>
<oz:TypeKadastraleAanduiding>
<oz:kadastraleGemeente>
<oz:KadastraleGemeente>
<t:code>272</t:code>
<t:waarde>Emmen</t:waarde>
</oz:KadastraleGemeente>
</oz:kadastraleGemeente>
<oz:sectie>AF</oz:sectie>
<oz:perceelnummer>58</oz:perceelnummer>
<oz:aKRKadastraleGemeenteCode>
<oz:AKRKadastraleGemeenteCode>
<t:code>319</t:code>
<t:waarde>EMN00</t:waarde>
</oz:AKRKadastraleGemeenteCode>
</oz:aKRKadastraleGemeenteCode>
</oz:TypeKadastraleAanduiding>
</oz:kadastraleAanduiding>

 

Anyone can help me?

0 Likes
5,221 Views
43 Replies
Replies (43)
Message 2 of 44

Pointdump
Consultant
Consultant

Patrick,
I changed .txt to .gml, dropped into QGIS and re-saved as a Shapefile. Attached.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 3 of 44

АлексЮстасу
Advisor
Advisor

patrickvanhoeijen, I can't import this GML either. Perhaps we need his scheme?

 

, No area objects were transferred.
I did through Global Mapper.

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 4 of 44

ChicagoLooper
Mentor
Mentor

I don't know how you got your gml but it looks like someone changed the extension from .gml to .txt. You can make a COPY of the dk_parceel.txt then change the extension of the copy back to .gml. Once you have the .gml you can use MAPIMPORT command to bring in the parcels and the accompanying object data.See image-1.

 

Image-1Image-1

 

 

 You only need to import Parceel, the other two gml's don't have any data or any geometry. It appears Map3D doesn't like long Target Field names. Most of the target fields are OK so you can keep them as is. For the ones that are too long, you can edit them so they'll be a few characters shorter. Change 'Type' to 'T' and 'Status' to 'Sta.' By shortening the target field names, you'll be able to import the Object Data. See image-2.

 

Image-2Image-2

 

 

Klazienaveen. Correct? A new layer has been created and this layer has adopted the name of the gml. The Object Data is displayed at the bottom of the Properties Palettes under the heading OD:Parceel.

 

Image-3Image-3

 

The method described above doesn't use third party software and doesn't use any add-on. The entire procedure was easily accomplished using Map3D.

Chicagolooper

EESignature

Message 5 of 44

patrickvanhoeijen
Contributor
Contributor

Thanks, however I need GML files and therefor a solution for these. My solution is not converting to shape. Anyway, your help is much appreciated!

0 Likes
Message 6 of 44

patrickvanhoeijen
Contributor
Contributor

Hmm, I can import, but not using all fields. Thanks for your reply.

0 Likes
Message 7 of 44

patrickvanhoeijen
Contributor
Contributor

Thanks a lot for this detailed description. Yes, I changed the gml extension to txt as I could not upload .gml before zipping. All clear now. Only one thing: In the future I need to import these files coming from an open source. So they will all be like this, with the long names. Is there a way to automise this shortening of names to be able to import complete?

0 Likes
Message 8 of 44

patrickvanhoeijen
Contributor
Contributor

Hmm, I did a complete test now: shortened all target field names until all were accepted. Unfortunately much information that is in the GML, like for example these values 272, Emmen, I, 9319 etc:
<oz:KadastraleGemeente>
<t:code>272</t:code>
<t:waarde>Emmen</t:waarde>
</oz:KadastraleGemeente>
</oz:kadastraleGemeente>
<oz:sectie>I</oz:sectie>
<oz:perceelnummer>9319</oz:perceelnummer>
<oz:aKRKadastraleGemeenteCode>
<oz:AKRKadastraleGemeenteCode>
<t:code>319</t:code>
<t:waarde>EMN00</t:waarde>


 

Are not shown in Autocad object data:

patrickvanhoeijen_0-1617109396611.png

 

Am I doing something wrong?

0 Likes
Message 9 of 44

TerryDotson
Mentor
Mentor

@patrickvanhoeijen wrote:

I did a complete test now: shortened all target field names until all were accepted.


Keep in mind that dBase III (.DBF Files) column names are limited to 10 characters.  That is one of the few negatives involved in using ShapeFiles.

0 Likes
Message 10 of 44

АлексЮстасу
Advisor
Advisor

Where did these fields come from?
In Global Mapper, I don't see them:

GM15.png   AC_Map.png

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 11 of 44

patrickvanhoeijen
Contributor
Contributor

You say: "I don't see...". In your screenshots I do see the values of the attributes I would like to see in Autocad Map importing this GML. So I would like to know how.

0 Likes
Message 12 of 44

АлексЮстасу
Advisor
Advisor

Apparently, Map cannot interpret your GML as described.
Alternatively, you can to create a *.xls schema for such GML that Map reads it correctly.
Or use a path via QGIS, GM or the like.

 

I tried a funny option. (Funny because I don't understand GML, XML, *.xls...).
When MAPEXPORT your data in GML from dwg is created schema - *.xls.
If you give this scheme when MAPIMPORT read your GML, the desired fields are visible.
However, objects are not imported. 😞
But the necessary fields are already visible. 🙂

 

Probably need a person who understands GML, XML...

 

gml_schema.png


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 13 of 44

Pointdump
Consultant
Consultant

Alexander,
Trying to MAPIMPORT that GML into Map 3D all I get is "Invalid data or no data found." I have no idea how @ChicagoLooper managed it. Anyway, after a re-save in QGIS I got an XSD file. I also saved as a CSV file. All attached.
Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 14 of 44

ChicagoLooper
Mentor
Mentor

To Mr. @Pointdump ,

To use MapImport, you'll need to change the .txt file back to its original extension of .gml. You can refer to post #17 which confirms my suspicion that the gml was edited prior to uploading to the forum.

 

101.png

 

Also refer to post #19 written by @TerryDotson . Terry is correct in saying the the attributes are too long. Map 3D wants Field Names that are 10 characters or less. Editing the filed name to abbreviations will get the job done. 

 

BTW, this 10 character limitation is also present when performing Bulk Copy. When you copy Fields from the orignal shapefile and pasting them into a new shapefile during Bulk Copy, the new Fields in the new shapefile can't be longer than 10 characters. Even though the orignal shapefile has Fields longer than 10, the new, or copied shapefile, can't. The solution when performing Bulk Copy is to abbreviate or shorten the new field names to less than 10 characters.

 

 

Chicagolooper

EESignature

0 Likes
Message 15 of 44

Pointdump
Consultant
Consultant

@ChicagoLooper,
Understand about the gml extension. Patrick told us about this in the first sentence of his first post.
I'm not getting to the point where I can change the attributes. Map 3D gives me this:

 

GML_2.png

 

GML_3.png

 

 

 

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 16 of 44

АлексЮстасу
Advisor
Advisor

I also did not succeed at first for the same reason - this is the import of the wrong GML, this is "CityGML", but you need to take the second - "Geography Markup Language".


Can you attach *.xsd if QGIS creates it when exporting to GML?

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

Message 17 of 44

Pointdump
Consultant
Consultant

Alexander,
Yes, you're right. I was using "CityGML", but when I used the second one everything came in fine. (I shortened the attribute names as @ChicagoLooper explained.)
I'm ashamed and embarrassed to admit that I don't have a clue how to attach an XSD file.
In QGIS all I got was some points. In Map 3D now there are 9246 objects--linework, points, and who knows what all. I suppose you could use a Map Annotation Template to label things.

 

GML_4.png

 


Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
Message 18 of 44

АлексЮстасу
Advisor
Advisor

I meant you to attach a *.xsd schema file to your forum message. 😀

 

And when importing, you can specify the desired file *.xsd - see picture in my 12.

 

 


-- Alexander, private person, pacifist, english only with translator 🙂 --

Object-modeling _ odclass-odedit.com _ Help

0 Likes
Message 19 of 44

Pointdump
Consultant
Consultant

Alexander,
When I click "Driver Options" I get something bad:

 

GML_5.png

 


Dave

Dave Stoll
Las Vegas, Nevada

EESignature

64GB DDR4 2400MHz ECC SoDIMM / 1TB SSD
NVIDIA Quadro P5000 16GB
Windows 10 Pro 64 / Civil 3D 2025
0 Likes
Message 20 of 44

patrickvanhoeijen
Contributor
Contributor

I am curious about this XSD file and how this could help me further.

0 Likes