2

I am data scientist not experienced in GIS and need to do some simple map plotting of the Netherlands. Using Geopandas everything works out nice and dandy for my purposes however I am stuck on 1 aspect:

The map I drew has the following CRS:

map_df__.crs {'init': 'epsg:28992'} (this is what NL looks like to de dutch native)

plain image of the Netherlands

I want to plot a couple of points of which I get the lon/lat coordinates from Google Maps.

Muddling my way to understand projections on the fly I got to this code:

map_df.to_crs(epsg=4289).plot(edgecolor='black')

Which gives this map: (Red dot: Amsterdam is an example)

squased map

To a Dutch person this map looks a bit squashed. I am guessing because because of the projection.

How do I plot a lon/lat point (without manual conversion) on an XY map i.e. how can make the squashed map look like the 'stretched' version?


The suggested espg: map_df.to_crs(epsg=3857).plot(edgecolor='black'), gives:

suggested eps 3857

  • 1
    I am not sure I understand the question, but a popular projection is Web Mercator. Try EPSG:3857 to see if that looks more of what you'd expect. – Richard Morgan Apr 25 at 17:42
  • Web Mercator is highly distorted as far north as the Netherlands. – Vince Apr 25 at 17:44
  • It appears the part you are missing is the need to reproject your decimal degrees point into your preferred coordinate reference for mapping. Yes, a Plate Carrée of geographic 4289 will look squashed, because it's Plate Carrée. In order for your point to align with any other coordsys, it must be projected into that coordsys. – Vince Apr 25 at 19:04
  • 1
    Please make sure Gerardus Mercator's birthplace is properly projected. – Kirk Kuykendall Apr 25 at 19:34
  • 1
    I would put your point in a geodataframe and use the reprojection support built into GeoPandas – Paul H Apr 26 at 13:53
3

I would put your point in a geodataframe and use the reprojection support built into geopandas.

That looks like this:

from matplotlib import pyplot
from shapely.geometry import Point
import geopandas

final_crs = {'init': 'epsg:28992'}
NL = (
    geopandas.read_file('nl_1km.shp')
        .to_crs(final_crs)
)

# note: always give `Point` x and then the y coord
amsterdamish = Point((4.9, 52.4))
gdf_am = geopandas.GeoSeries([amsterdamish], crs={'init': 'epsg:4326'})

fig, ax = pyplot.subplots(figsize=(6.5, 6.5))
NL.plot(ax=ax, facecolor='none', edgecolor='0.35')
gdf_am.to_crs(final_crs).plot(ax=ax)

And I get:

enter image description here


NB: my NL dataset is weird, but it came from here: https://www.eea.europa.eu/data-and-maps/data/eea-reference-grids-2/gis-files/netherlands-shapefile

0

I don't speak pandas, but:

map_df__.crs {'init': 'epsg:28992'}

likely tells it to map a dataframe, using the CRS (coordinate reference system) of a certain number (28992); which I looked up here: https://spatialreference.org/ref/epsg/28992/

Looking at your code, I do not see anything which adds a dot to the map.

EPSG stands for European Petroleum Survey Group. They publish a database of coordinate system information plus some very good related documents on map projections and datums.

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.