I have a list of lat,lon coordinates from Flickr pictures taken in Sydney (see here)
When I plot these points on google maps, the locations are correct (see here)
However when I use my Basemap the results are not correct. This is especially noticable at the coastlines: .
I've tried changing the Basemap to a variety of EPSG codes without success, I've tried converting the coordinates to different EPSG codes without success.
I'm not really sure where to go from here. Right now I'm just trying things out but nothing seems to be working, so any help would be greatly appreciated! Cheers
Main code:
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
import math
import pyproj
location_data = get_location_data("sydney")[:500]
bmap = create_map()
for lat, lon in location_data:
plot_on_map(bmap, float(lat), float(lon))
show_map()
methods:
#
# Create a Basemap and return it
#
def create_map():
lower_left_lat = -34.126127
lower_left_lon = 150.951113
upper_right_lat = -33.751265
upper_right_lon = 151.425672
bmap = Basemap(projection='merc', # doesn't need to be mercator
llcrnrlat=lower_left_lat,
urcrnrlat=upper_right_lat,
llcrnrlon=lower_left_lon,
urcrnrlon=upper_right_lon,
resolution='f',
epsg='4326')
bmap.drawcoastlines()
bmap.drawcountries()
bmap.fillcontinents(lake_color='aqua')
bmap.drawmapboundary()
return bmap
#
# Plot coordinates lat, lon on the Basemap map
#
def plot_on_map(bmap, lat, lon):
#gda94 = pyproj.Proj(init='epsg:4283')
#mgaz56 = pyproj.Proj(init='epsg:4326')
#x, y = pyproj.transform(gda94, mgaz56, lon, lat)
x,y = bmap(lon, lat)
bmap.plot(x, y, 'bo', markersize=3)
def show_map():
plt.show()