Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use GDAL's ogr2ogr tool to edit Geojson data with ArcGIS Desktop

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Use ogr2ogr tools

The official website address http://www.gdal.org/ogr2ogr.html, download the required version, considering that the author will often use it in the future, I extracted it to the folder "D:\ App\ Gdal\ release-1500-gdal-2-2-1-mapserver-7-0-6".

The path set in Path for ease of use.

Open a command line window, test the ogr2ogr command failed, display

After running "D:\ App\ Gdal\ release-1500-gdal-2-2-1-mapserver-7-0-6\ SDKShell.bat" in the command line window run as an administrator, you can use the ogr2ogr command.

2. The conversion between geojson and shp

Use the command

Ogr2ogr-lco encoding=UTF-8-f "ESRI Shapefile" E:\ data\ china_20171027_1349.shp E:\ data\ china.json

And

Ogr2ogr-f "GeoJSON" E:\ data\ china_region_20171027_1604.json E:\ data\ china_region_20171027_1604.shp

However, to achieve the conversion between geojson and shp, it should be noted that when there are Chinese characters in geojson, the parameter "- lco encoding=UTF-8" needs to be added, otherwise garbled code will occur and a warning message will be generated. When shp is converted to geojson, no additional parameters are needed, such as increasing the encoding setting, which will also generate a warning message.

3. Data editing

This task is to divide Inner Mongolia into eastern Mongolia and western Mongolia in the national provincial administrative division layer.

The data available include "china.json" and "nei_meng_gu_geo.json" in geojson format.

Due to the use of gdal's ogr2ogr tool, we can easily get the corresponding shp data, we only need to solve the editing of shp.

1) load nei_meng_gu_geo layers in ArcGIS Desktop

2) Open editing tools-> start editing, select features according to business needs, and select merge tools in the editing toolbar

3) after merge, classified rendering, and loading the national provincial administrative divisions, we found that there are many edges in neighboring provinces that either coincide or have gaps, basically no match, such data obviously can not be used. This kind of problem is very common in data editing, mainly because of different data sources and different data accuracy.

4) We use the method of line cutting to solve the problems in 3). Find the "Feature To Line" tool in ArcToolbox

The result is obtained after processing.

Re-open the editing state to edit the Polyline data of nei_meng_gu_geo

Delete the useless line and merge the next trim line

The current effect is as follows

Set to display only Inner Mongolia Polygon

Open it again and start editing, this time editing "china_20171027_1349"

Select the break line and open the advanced editing tool. Select the tool as follows

5) final effect

At this point, the task is complete!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report