Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16624

How remove residual lines after merge two regions using Geopandas in python?

$
0
0
import geopandas as gpdsg = gpd.read_file('shapefile1.shp')sd = gpd.read_file('shapefile2.shp')kw = sg[sg['region_name'] == 'region1']tg = sd[sd['region_name'] == 'region2']

region1 and region2 are as below:enter image description here

mr = kw.geometry.reset_index(drop=True).union(tg.geometry.reset_index(drop=True))mr.plot()

I can get the image from mr as below:

enter image description here

But, see the boundary of the region

mr.boundary.plot()

enter image description here

I can see the residual lines as the image above.

How remove these residual lines?

I'v tried to remove them using simplify(tolerance=0.01) and buffer(0) functions.But I failed.

I just expect to get outlines of the first image with empty inside.


Viewing all articles
Browse latest Browse all 16624

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>