2

I'm currently transferring from ESRI to open source GIS by recreating basic ArcGIS tasks in Python, mainly using Geopandas since I have some experience with Pandas.

Now I'm trying to intersect a Building_Footprint shapefile with a one-mile buffer of a point.

The input data:

Building footprint:

BLDG

Center point around which the buffer is made:

center=pd.DataFrame({ 'Lat':[40.603155], 'Lon':[-75.478003]})

center_g = [Point(xy) for xy in zip(center.Lon, center.Lat)]
cg = gpd.GeoDataFrame(center, geometry=center_g)
cg.crs = {'init' :'epsg:4326'} 
cg = cg.to_crs(bldg.crs)

And then I made a one-mile buffer around the center:

cg.buffer(5280) #The map unit is ft hence the number 5280

Now this is where I'm stuck. I'm trying to intersect the buffer with the bldg GeoDataFrame. So I tried this:

bldg1 = bldg.unary_union

to convert bldg to a single feature so it may be faster. But it takes forever since there are more than 160K records in bldg.

I've spend quite a lot of time on this task while it could be easily done in ArcGIS. I'm wondering what's the best way to go at it.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Bowen Liu
  • 663
  • 8
  • 18
  • @BERA Thanks for the reply. I have not but I'm going to. One thing I'm worried about is: after I do the cg.buffer(5280) step, the result will be a single object hence a shapely object. Can I still use it as input for geopandas.overlay? I feel like there is much restriction on single shapely objects. Thanks again. – Bowen Liu Apr 24 '19 at 18:58
  • @BERA You may have just saved my life here. But to ensure both of them are projected together, is it better to use gpd.GeoDataFrame(crs=bldg.crs? I'm having trouble with my projection system as well. If you care to take a look: https://gis.stackexchange.com/questions/320757/coordinate-system-shows-up-incorrect-after-converting-a-shapely-object-to-a-shap – Bowen Liu Apr 24 '19 at 19:16
  • @BERA You just reminded me that I may have been doing everything wrong. I thought to_crs is actually projected coordinate system. I guess it's the actual geospatial system. How to specify a projected coordinate system then? Getting stuck in coordinate system is my worst trouble, I shall just use WGS84 for both files. But then how shall I specify buffer radius? Degree is a headache compare to usual length unit. Thanks. – Bowen Liu Apr 24 '19 at 19:24
  • Cross-posted as https://stackoverflow.com/q/55836453/820534 – PolyGeo Apr 25 '19 at 01:23

0 Answers0