1

I have 2 geodataframes that I want to combine. They the same fields/columns but different geometries (one is points, one is polygons).To do this I want to buffer the points slightly (like 10m or something) so that points_gdf['geometry'] is changed to a "POLYGON". I tried changing to an projected crs that should be in meters first:

points_df = points_df.to_crs({'init': 'epsg:3174'})
points_df['geometry'] = points_df.geometry.buffer(10)

Once the buffer has completed, I concatenate it with my polygon geodataframe and change the crs back to the original.Then I write it to a shapefile to view it.

df_list = [poly_df, points_df]
final_combine = gpd.GeoDataFrame(pd.concat(df_list,sort=True))
final_combine.crs = {'init': 'epsg:4326'}
final_combine.to_file(final_out_feat)

When I view it, I am getting these giant polygon points that completely overshadow the other polygons. What could I be doing wrong here?

  • 1
    Almost always you are buffering in degrees instead of meters. Try projecting to EPSG 3857 as a test, although it seems that 3174 is indeed meters. Also, include the code you use to change the crs back to the original. – Jon Aug 1 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.