Basemap projection

686 views Asked by At

I have latitude and longitude data in the following format 11.422, 47.3156

I want to plot these points on a basemap, but I don't know which projection to use to get them plotted right. Tried out a few but didn't worked out, please help me.

2

There are 2 answers

0
javaEd On

You can do it by following the documentation at: http://matplotlib.org/basemap/api/basemap_api.html And also by trying out http://matplotlib.org/basemap/users/examples.html

0
skytaker On

The projection you use depends on your purposes for the map. Here is a simple example using your lat/lon and the common Transverse Mercator projection:

#!/bin/env python3
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap

# set map boundaries
south, north = 3, 20
west, east = 38, 56
center = [(east+west)/2, (north+south)/2]

# define basemap
m = Basemap(llcrnrlon=west, llcrnrlat=south, urcrnrlon=east, urcrnrlat=north,
            resolution='l', projection='tmerc', lat_ts=0,
            lon_0=center[0], lat_0=center[1])

# plot features
m.drawcoastlines()
m.drawcountries()
m.drawstates(color='w')
m.drawrivers(color='lightblue')
m.shadedrelief()

# plot point(s)
lons, lats = [47.3156], [11.422]
x, y = m(lons, lats)
m.scatter(x, y)
plt.text(x[0], y[0], 'You Are Here!', ha='center', va='bottom')

# show map
plt.show()

you_are_here.png