Geographic Information Systems Asked on December 4, 2020
I am using GeoPandas and matplotlib to plot some circles of desired radius around a set of points.
I find that the circles are not the right size on the maps, but the equivalent sized circles drawn on Google Earth are correct.
Here is the general code sequencing.
points_wgs84 = gpd.GeoDataFrame(
pdf_frame,
geometry=gpd.points_from_xy(pdf_frame.longitude, pdf_frame.latitude),
crs={'proj': 'latlong', 'ellps': 'WGS84', 'datum': 'WGS84', 'no_defs': True}
).rename(
columns={'geometry': 'measurement_coordinates'}
).set_geometry('measurement_coordinates')
points_3857 = points_wgs84.to_crs(epsg=3857)
Here are the radius values for the circles to be plotted:
143 3120.545547
1430 3120.545547
2421 3120.545547
4789 3126.559006
2011 3126.559006
3592 3126.559006
59 3133.507389
4835 3133.507389
3549 3133.507389
1174 3133.507779
2225 3133.507779
2639 3133.507779
4481 3154.907523
2359 3154.907523
1901 3154.907523
2144 3176.645992
4073 3176.645992
5010 3176.645992
points_3857['disc'] = points_3857.buffer(points_3857['radius'].astype(float))
points_disc_3857 = points_3857.set_geometry('disc', drop=False, inplace=False, crs='epsg=3857')
points_disc_3857['circle'] = points_disc_3857.boundary
points_circles_3857 = points_disc_3857.set_geometry('circle', drop=False, inplace=False, crs='epsg=3857')
Then plotting the result with the code:
plt.rcParams["figure.figsize"] = (20, 20)
ax = points_circles_3857.plot(alpha=.3)
ctx.add_basemap(ax)
points_3857.plot(ax=ax, c='r',alpha=0.3)
I see a map that looks like this:
The circle are supposed to be in the range of 3120 – 3180 m in radius.
Now comparing, I find that the equivalent sized circle on Google Earth measure at 2600 m.
I used the intersection of the roads at about 170 degrees as the common reference to make the measure.
I believe that Google Earth uses true Mercator, and that 3857 is Web Mercator, but I cannot figure out how to get the measurements in GE and GeoPandas plotting to match.
I am looking to understand if I have the wrong coordinate transformations for the CRS, and how I can fix the relationship match.
I'm not familiar with the tools you are using, so I may be wildly off here, but: It looks like you are computing your circles by doing a “buffer” operation in Web Mercator coordinates. That’s a bad idea. The units in Web Mercator are nominally meters, but because of the brutal distortions of a global Mercator projection, those "meters" don’t really mean much. (That's why Greenland looks bigger than Africa on so many world maps). I think you’d be better off doing your calculations in a more appropriate space — perhaps the applicable UTM zone — and converting to Web Mercator for display.
Answered by Ture Pålsson on December 4, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP