我有一张来自悉尼拍摄的Flickr照片的lat,lon坐标列表(见here)
当我在谷歌地图上绘制这些点时,位置是正确的(参见here)
然而,当我使用我的Basemap时,结果不正确。这在海岸线尤其明显:。
我尝试将Basemap更改为各种EPSG代码但未成功,我尝试将坐标转换为不同的EPSG代码但未成功。
我不确定从哪里开始。现在我只是尝试一下,但似乎没有任何工作,所以任何帮助将不胜感激!干杯
主要代码:
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()
方法:
#
# 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()