Is_land in basemap (python)

I am trying to disguise the ground with help .is_landfrom mpl_toolkits.basemap.

When running the following code:

map = Basemap(llcrnrlon = 7.298914095230308, llcrnrlat = 58.98235690451632, urcrnrlon = 12.27072348324015, urcrnrlat = 57.92306182768044,projection='cyl', resolution='f')

value = map.is_land(11.61168822665539, 57.86868795294363)

print(value) returns false

but if you do not specify an area

map = Basemap(projection='cyl', resolution='f')

value = map.is_land(11.61168822665539, 57.86868795294363)

print(value) returns true

That I can’t understand why.

I really need to specify the area, otherwise the code will work 5-6 times slower.

+4
source share
1 answer

is_land. http://matplotlib.org/basemap/api/basemap_api.html?highlight=is_land#mpl_toolkits.basemap.Basemap.is_land is_land True, x, y ( ) , False. GSHHS, .   .

, x, y , is_land. :

map = Basemap(llcrnrlon = 7.298914095230308, llcrnrlat = 58.98235690451632, 
               urcrnrlon = 12.27072348324015, urcrnrlat = 
               57.92306182768044,projection='cyl', resolution='f')

lon, lat = 11.61168822665539, 57.86868795294363) # test coords
xpt, ypt = map( lon, lat ) # convert to projection map
value = map.is_land(xpt, ypt) # test is_land
+1

Source: https://habr.com/ru/post/1674384/


All Articles