Зачем конвертировать GML в GEOJSON?
GML (Geography Markup Language) is an XML-based OGC standard for geographic features introduced in 2000. GeoJSON stores the same features as JSON and is the standard input for web mapping libraries such as Leaflet and Mapbox. Web tools rarely read .gml directly, making conversion the practical step before publishing geographic data on a map.
Способы конвертации GML в GEOJSON
GDAL/OGR (ogr2ogr) OPEN-SOURCE
Run ogr2ogr -f GeoJSON out.geojson in.gml in a terminal; add -t_srs EPSG:4326 to reproject to WGS 84 if the source CRS is not already geographic.
QGIS FREE
Add the .gml as a vector layer, right-click it in the Layers panel, choose Export > Save Features As, set format to GeoJSON, and set CRS to EPSG:4326.
Об этих форматах
Файл .gml - это файл Geography Markup Language (язык географической разметки), формат XML, определенный Open Geospatial Consortium (OGC) для хранения карт и данных ГИС, таких как точки,…
Открыть детали .GML →Файл GEOJSON хранит географические объекты - точки, линии и полигоны с их атрибутами - в виде обычного текста JSON и является стандартным форматом для веб-картографии. Чтобы просмотреть его…
Открыть детали .GEOJSON →Качество и на что обратить внимание
- GeoJSON (RFC 7946) requires WGS 84 geographic coordinates; always reproject during export if the source CRS is a local projected system.
- Feature attributes and geometry (points, lines, polygons) carry over intact to the GeoJSON
propertiesand geometry objects. - Both formats are text-based; the output
.geojsonfile is similar in size to or slightly smaller than the source.gml.
Часто задаваемые вопросы
Does QGIS include GDAL?
ogr2ogr command-line tool.Will mixed geometry types in a GML file cause problems?
Why does my GeoJSON display incorrectly on a web map?
-t_srs EPSG:4326 in ogr2ogr or select EPSG:4326 in the QGIS export dialog.