Use Gdal's Ogr2ogr tool, combined with ArcGIS Desktop for Geojson data editing

Source: Internet
Author: User

1. Using OGR2OGR Tools

Website address http://www.gdal.org/ogr2ogr.html, download the required version, considering the author will often use later, I unzipped it to the folder "D:\App\Gdal\ Release-1500-gdal-2-2-1-mapserver-7-0-6 "under.

For ease of use, set the path in path.

Open command Line window, Test ogr2ogr command failed, display

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/27/69e042b353a8fdcda282dcf68601fdb4.png-wh_500x0-wm_3 -wmp_4-s_1107493769.png "title=" in command line run OGR2OGR error "alt=" 69e042b353a8fdcda282dcf68601fdb4.png-wh_ "/>

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


2. Conversion of Geojson and SHP to each other

Using commands

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

But to achieve Geojson and SHP mutual transfer, it should be noted that geojson with Chinese characters, the need to add the parameter "-lco encoding=utf-8", otherwise garbled, and produce warning message. When SHP turns Geojson, no additional parameters are required, such as adding encoding settings, which also generates a warning message.


3. Data editing

The task is to divide the Inner Mongolia into Montommoncy in the National Provincial administrative division layer.

The data available on hand include "China.json" and "Nei_meng_gu_geo.json" in the Geojson format.

With the use of the Gdal ogr2ogr tool, we can easily get the corresponding SHP data, we now only need to solve the SHP editor.

1) load the NEI_MENG_GU_GEO layer in ArcGIS Desktop

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/27/6a158af4606802848c4deaef3aca962f.png-wh_500x0-wm_3 -wmp_4-s_4243497053.png "title=" loading original Inner Mongolia prefecture level administrative divisions "alt=" 6a158af4606802848c4deaef3aca962f.png-wh_ "/>

2) Open editing tools, start editing, select features according to your business needs, and choose the Merge tool in the editing toolbar

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/27/593b4d951a64a03f4db5c89635897a3a.png-wh_500x0-wm_3 -wmp_4-s_3634698777.png "title=" merge feature "alt=" 593b4d951a64a03f4db5c89635897a3a.png-wh_ "/>

3) After the merge, classification rendering, and loading the National Provincial Administrative divisions, we found in the neighboring provinces where there are many edge or overlap or there are gaps, basically no match, such data, is obviously not available. This problem is common in data editing, mainly due to different data sources and data accuracy.

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/27/9f368c0c4832dfa4d09d2088936dce6b.png-wh_500x0-wm_3 -wmp_4-s_192336833.png "title=" after editing and national map comparison "alt=" 9f368c0c4832dfa4d09d2088936dce6b.png-wh_ "/>

4) We use line clipping method to solve the problem in 3). Find the "Feature to Line" tool in Arctoolbox

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/27/b5baf6532cbda3c5c4fb1ea6735f3f27.png-wh_500x0-wm_3 -wmp_4-s_818521391.png "title=" Feature to Line "alt=" B5baf6532cbda3c5c4fb1ea6735f3f27.png-wh_ "/>

Get results after processing

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/27/f1c4e958f728340c6a8d681ac7110454.png-wh_500x0-wm_3 -wmp_4-s_1046211611.png "title=" Inner Mongolia Line Layer "alt=" F1c4e958f728340c6a8d681ac7110454.png-wh_ "/>

Re-open edit state to edit Nei_meng_gu_geo's polyline data

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/27/b607d5dfe409b861dad137147db1c007.png-wh_500x0-wm_3 -wmp_4-s_1949120739.png "title=" Edit line Data "alt=" B607d5dfe409b861dad137147db1c007.png-wh_ "/>

Delete the useless line and merge the next crop tangent

650) this.width=650; "Src=" Https://s2.51cto.com/oss/201710/27/89dea06991a07d9e79b2f86e548e45d9.png-wh_500x0-wm_3 -wmp_4-s_618742503.png "title=" Merge Cut line "alt=" 89dea06991a07d9e79b2f86e548e45d9.png-wh_ "/>

The effect is as follows

650) this.width=650; "Src=" Https://s3.51cto.com/oss/201710/27/b423515c13f06ae1da7d9a4224e24e61.png-wh_500x0-wm_3 -wmp_4-s_188304161.png "title=" Current Effect "alt=" B423515c13f06ae1da7d9a4224e24e61.png-wh_ "/>


Settings show only Inner Mongolia polygon

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/27/6e0c62e27be1181c98d6233cc7fd0ead.png-wh_500x0-wm_3 -wmp_4-s_768721993.png "title=" setting shows Inner Mongolia "alt=" 6e0c62e27be1181c98d6233cc7fd0ead.png-wh_ "/>

Open the edit again, this time for "china_20171027_1349"

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/27/8fa4bde628219d6f89abded9ef1cdc8b.png-wh_500x0-wm_3 -wmp_4-s_302718889.png "title=" editor Inner Mongolia Polygon "alt=" 8fa4bde628219d6f89abded9ef1cdc8b.png-wh_ "/>

Select the truncation line, open the advanced Editing tool, and select the tool below

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/27/a336d98bca0bcc51a5fd984892adf2f3.png-wh_500x0-wm_3 -wmp_4-s_3807196477.png "title=" truncated polygon "alt=" A336d98bca0bcc51a5fd984892adf2f3.png-wh_ "/>

650) this.width=650; "Src=" Https://s1.51cto.com/oss/201710/27/964eddc96659b2b5940218f3d4d6d687.png-wh_500x0-wm_3 -wmp_4-s_4180105653.png "title=" default parameter "alt=" 964eddc96659b2b5940218f3d4d6d687.png-wh_ "/>

650) this.width=650; "Src=" Https://s4.51cto.com/oss/201710/27/91fd94b67ff26bf971b7ca9a0840bf27.png-wh_500x0-wm_3 -wmp_4-s_1030164820.png "title=" crop result "alt=" 91fd94b67ff26bf971b7ca9a0840bf27.png-wh_ "/>

5) The final effect

650) this.width=650; "Src=" Https://s5.51cto.com/oss/201710/27/8ae5f7782045fb5cf1e4b29181de71f6.png-wh_500x0-wm_3 -wmp_4-s_1232346497.png "title=" final Effect "alt=" 8ae5f7782045fb5cf1e4b29181de71f6.png-wh_ "/>


At this point, the task is complete!

This article from "Zi Zhu ge zi" blog, reproduced please contact the author!

Use Gdal's Ogr2ogr tool, combined with ArcGIS Desktop for Geojson data editing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.