2

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: Circles of radius about 3170 m

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.

Google Earth image showing size of equivalent circles from

1 Answer 1

1

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.

3
  • Thanks for your comment Ture. For the same project, I have translated some extremely accurate transformations from Matlab to Python, for Mercator based on WGS-84 (taking into account the ellipsoid eccentricity etc), so I have seen first hand the exact problem to which you refer. I am hoping that someone has the information I need to deal with the difference between Mercator and Web Mercator as used by the mapping tools from GeoPandas.
    – David
    Commented Aug 30, 2020 at 19:27
  • With the transformations I used in the background, I was able to make measurements that are exactly consistent with Google Earth.
    – David
    Commented Aug 30, 2020 at 19:34
  • This. cos(33.6) = 0.833 >> 2582 = 0.833*3100. The pop-up is likely calculating the geodesic distance for the radius, which will be shorter than the Mercator distance
    – mkennedy
    Commented Aug 30, 2020 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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