I want to display a world map on a bokeh plot, on which I use lat/lon coordinates (i.e. -90 to +90, and -180 to +180) to display various points over the map.
Problem:
Using the predefined 3rd party tiles (Stamen, CartoDB) does not seem to work with this approach, as they work in meters. Hence, the plot y range for example is interpreted as -90 to +90 meters on the earth map, hence the tile is basically showing the area of 180mx360m at location 0,0.
On the other hand, zooming out (a lot) will show the map but then my lat/lon points are obviously condensed into the map center.
Questions:
Only BBoxTileSource has a flag ‘use_latlon’, to choose between meters or lat/lon. Where is this conversion done? Do I need to provide this logic on my own?
Where to find a tile provider (e.g. OSM) that accepts BBOX as argument and returns an appropriate tile?
Should it not be THE most basic use case to work with lat/lon on a world map? At least that is what I see on EVERY world map. Meters are used only for scale.
The meters system is not scale, it is Web Mercator which is in common use by all major map tile systems, AFAIK. The immediate solution is for you to convert your lat/lon coordinates to Web Mercator (meters) before passing them to Bokeh plotting functions. There is nothing built in to Bokeh to do this, so yes you will need to do it explicitly yourself. There are various libraries (pyproj, cartopy, etc.) that should be helpful with this. Alternatively, this seems to be a relevant SO answer:
A separate question is what can/should be done to make things simpler or easier for Bokeh users. I'm happy to have a discussion about it, but realistically what is needed is a new contributor with a specific interest in improving Bokeh for GIS plotting to join and help support this part of Bokeh.
Goal:
- I want to display a world map on a bokeh plot, on which I use lat/lon coordinates (i.e. -90 to +90, and -180 to +180) to display various points over the map.
Problem:
- Using the predefined 3rd party tiles (Stamen, CartoDB) does not seem to work with this approach, as they work in meters. Hence, the plot y range for example is interpreted as -90 to +90 meters on the earth map, hence the tile is basically showing the area of 180mx360m at location 0,0.
- On the other hand, zooming out (a lot) will show the map but then my lat/lon points are obviously condensed into the map center.
Questions:
- Only BBoxTileSource has a flag 'use_latlon', to choose between meters or lat/lon. Where is this conversion done? Do I need to provide this logic on my own?
- Where to find a tile provider (e.g. OSM) that accepts BBOX as argument and returns an appropriate tile?
- Should it not be THE most basic use case to work with lat/lon on a world map? At least that is what I see on EVERY world map. Meters are used only for scale.
- Am I completely on a lost track?
I don't actually remember anything at all about BBOxTileSource. It's possible if you configure it with the standard tile provider URLs but also specify use_latlon=True then things will work. But I have no personal experience with BBoxTileSource so I can't say for sure. You can see the configurations that the other tile providers use here:
On Feb 26, 2018, at 12:23, Bryan Van de ven <[email protected]> wrote:
Hi,
The meters system is not scale, it is Web Mercator which is in common use by all major map tile systems, AFAIK. The immediate solution is for you to convert your lat/lon coordinates to Web Mercator (meters) before passing them to Bokeh plotting functions. There is nothing built in to Bokeh to do this, so yes you will need to do it explicitly yourself. There are various libraries (pyproj, cartopy, etc.) that should be helpful with this. Alternatively, this seems to be a relevant SO answer:
A separate question is what can/should be done to make things simpler or easier for Bokeh users. I'm happy to have a discussion about it, but realistically what is needed is a new contributor with a specific interest in improving Bokeh for GIS plotting to join and help support this part of Bokeh.
Goal:
- I want to display a world map on a bokeh plot, on which I use lat/lon coordinates (i.e. -90 to +90, and -180 to +180) to display various points over the map.
Problem:
- Using the predefined 3rd party tiles (Stamen, CartoDB) does not seem to work with this approach, as they work in meters. Hence, the plot y range for example is interpreted as -90 to +90 meters on the earth map, hence the tile is basically showing the area of 180mx360m at location 0,0.
- On the other hand, zooming out (a lot) will show the map but then my lat/lon points are obviously condensed into the map center.
Questions:
- Only BBoxTileSource has a flag 'use_latlon', to choose between meters or lat/lon. Where is this conversion done? Do I need to provide this logic on my own?
- Where to find a tile provider (e.g. OSM) that accepts BBOX as argument and returns an appropriate tile?
- Should it not be THE most basic use case to work with lat/lon on a world map? At least that is what I see on EVERY world map. Meters are used only for scale.
- Am I completely on a lost track?