GeoJson export, missing point names
When I export a layer with lines and named points in GeoJson format, the point name property is missing.
This example is a single simple line and 3 named points. When exported to KML or GPX, the point names are present.
I am using GM v23.
If this is not a bug, have I missed a switch somewhere?
Thanks
Howard
{
"type": "FeatureCollection",
"name": "F:\\DriveD_Downloads\\GMexport.geojson",
"features": [
{ "type": "Feature", "properties": { "LENGTH": "406.82 m", "BEARING": "174.7329°", "SINUOSITY": "4.0726399" }, "geometry": { "type": "LineString", "coordinates": [ [ 540443.430971995345317, 191728.024047445505857 ], [ 540554.515751725179143, 191716.727290184848243 ], [ 540585.895633004722185, 191674.050651644560276 ], [ 540637.986235928954557, 191651.457137123215944 ], [ 540594.054402137524448, 191636.394794109015493 ], [ 540455.355326881515794, 191628.863622601900715 ] ] } },
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 540445.941362497629598, 191756.893538222764619 ] } },
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 540577.736863872036338, 191738.065609454992227 ] } },
{ "type": "Feature", "properties": { }, "geometry": { "type": "Point", "coordinates": [ 540587.150828255922534, 191611.290889085299568 ] } }
]
}
Best Answer
-
Not too good morning.
1. In the attribute table, select groups of similar objects(Areas, Lines, Points) and successively create new layers from them.
We get the following schedule:
2.Remove the now empty original layer.
3.In the vector options window, set the label options correctly. Take the required attribute from the attribute table.
4.We separately assign current style attributes to each layer. Also (just in case) in the same window we update the attribute information.
5.And Export.
Answers
-
Hi!
-
Thank you for that, it looked promising, but sadly the point name properties were not in the exported Geojson file. The style attributes that were previously missing were included, which is good.
The second json file at the bottom contains just one point named Point1, this file was created in geojson.io to check syntax. "type": "Feature", "properties": {"name": "Point1"}
It is that syntax of named points that is missing from the GM export.
What on earth am I missing or is it a bug?
Howard
{
"type": "FeatureCollection",
"name": "F:\\DriveD_Downloads\\test4.json",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "LENGTH": "894.28 m", "BEARING": "143.9258°", "SINUOSITY": "4.9772355", "LINE_STYLE": "Solid", "LINE_COLOR": "RGB(0,0,211)", "LINE_WIDTH": "1", "FONT_SIZE": "10", "FONT_COLOR": "RGB(0,0,0)", "FONT_CHARSET": "1", "FONT_WEIGHT": "400" }, "geometry": { "type": "LineString", "coordinates": [ [ 0.019836034964814, 51.607554893157342 ], [ 0.024587802058476, 51.60747305321047 ], [ 0.02463467473525, 51.606770229373147 ], [ 0.019904056584673, 51.606823907145518 ], [ 0.01983847868487, 51.606352392660924 ], [ 0.021363197956858, 51.606249695108744 ] ] } },
{ "type": "Feature", "properties": { "FONT_SIZE": "12", "FONT_COLOR": "RGB(0,0,0)", "FONT_CHARSET": "1", "POINT_SYMBOL": "Well" }, "geometry": { "type": "Point", "coordinates": [ 0.019992084262836, 51.608052653704604 ] } },
{ "type": "Feature", "properties": { "FONT_SIZE": "12", "FONT_COLOR": "RGB(0,0,0)", "FONT_CHARSET": "1", "POINT_SYMBOL": "Well" }, "geometry": { "type": "Point", "coordinates": [ 0.022335150154245, 51.6080262220257 ] } },
{ "type": "Feature", "properties": { "FONT_SIZE": "12", "FONT_COLOR": "RGB(0,0,0)", "FONT_CHARSET": "1", "POINT_SYMBOL": "Well" }, "geometry": { "type": "Point", "coordinates": [ 0.022119778745546, 51.606445186009914 ] } }
]
}
........................................................
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"name": "Point1"
},
"geometry": {
"coordinates": [
0.02148115968512343,
51.60711609356258
],
"type": "Point"
}
}
]
}
-
Hi, Howard!
My English is far from perfect.) Infernal Google Translator does not allow us to fully discuss everything. Could you post the source file here so I can experiment with it? Of course I won't be using it anywhere else!
-
Thank you for trying. I have attached a .KML file that contains one simple line and three named points. Load that into GM and export as GeoJson. What I get is all the geometry but the points do not have their name, Well1, Well2, Well3.
When I load the .geojson file into geojson.io to check the file syntax, all is OK except the missing name properties.
Thanks
Howard
-
Hi, Howard!
"Easier than taking candy from a baby!" - Robin Hood. From unpublished.
So:
Next:
Further, as I wrote above:
Result:
-
Many thanks for your efforts. Sadly it does not solve the problem, the 3 point features, Well1, Well2 and Well3 are all now called point1, so all the name information is still lost in the GeoJson export.
It seems my only solution is to keep using KML and not bother with GeoJson.
It does look like a bug in GM, to export feature point names in GPX or KML but not GeoJson.
Thanks
Howard
-
I just don't understand what you want to call your points.
-
Here is a fragment of a project I am working on. It contains a number of named places (as points) like Hollandscheschur Farm. When I export that as a KML, the Hollandscheschur Farm name remains in the file. When I export to GeoJson, it does not. The point names are all missing.
I think this is a GM bug, at least in Ver 23 that I am using.
Thank you for your efforts.
Howard
-
Howard,
Is this any good?
-
Hello
Yes, that has the names in the GeoJson. How did you do that?
I assume that because the file contains "type": "Feature", "properties": { "KML_STYLE": "point6", "NAME": "Maedelstede Farm "
that you had to go from the KML and not the GM Package.
Howard
-
Hi, Howard!
It's a little late today, I have to get up early in the morning. Tomorrow I will post new comics!
-
Now I see, thank you for your efforts. I have learned a lot about a GM menu that I had not used much.
It seems that to output GeoJson with names in place I need to change my project's layer structure. To do that I would need to make a copy of the whole GM project, re-arrange all the layers into Area, Lines etc. then export. Then delete the copy project and go back to work on the original.
I have found an easier way. I export as a KML then convert to GeoJson using geoprocessing.online. That does the job and leaves my project intact.
Many thanks for your trouble. I still see the lack of names in a normal GM GeoJson export as a bug, they are all there in KML or GPX files.
Thanks again
Howard
-
Glad to help, old man!
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 345 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 637 GM Script Language
- 54 User Scripts
- 114 GPS Features
- 417 Projection Questions
- 826 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 913 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 569 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 238 How I use Global Mapper
- 107 Global Mapper Forum Website