0
buf_df = geodata.copy()
buf_df['geometry'] = buf_df['geometry'].buffer(10)
fig, ax = plt.subplots(figsize=(10,10))
tx_shapefile.plot(ax=ax, facecolor='Grey', edgecolor='k',alpha=1,linewidth=1,cmap="binary")
buf_df.plot(ax=ax,color='red')
plt.title('Locations', fontsize=15,fontweight='bold')
plt.xlim(-98,-94)
plt.ylim(28,32)
ax.set_xlabel('Longitude')
ax.set_ylabel('Latitude')
plt.show()

I want to plot the buf_df onto a shapefile plot. Basically draw buffer circles over my (lat,long) coordinates on the map. But it plots only a single circle on a normal plot

1 Answer 1

0

It looks like the coordinates of your geometries are in degrees, not in real-world distance units (like meters or feet). Therefore, the value you're using for your buffer is way too large and generates these huge circles that envelop your entire plotting area.

Try substituting your second line with this one:

buf_df['geometry'] = buf_df['geometry'].buffer(0.01)

This way, the buffer being generated is significantly smaller and will allow you to see most other things on the map.

If you need to draw a buffer of a specific size in the real world (for example, 10 meters, or 10 kilometers), you'll have to convert the GeoDataFrame's CRS to a projection-based one, apply the buffer, and then go back to the original CRS.

2
  • 1
    Thanks, it works perfect Feb 3 at 17:31
  • No worries! I'm glad it helped =)
    – Felipe D.
    Feb 4 at 23:56

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.