Skip to content Skip to sidebar Skip to footer

Plotly: Create Map Based On Geojson File

I've found a GeoJSON file containing all cities in The Netherlands. I'm now trying to plot this map using Plotly, but I can't seem to figure out how to do this. I know it's possibl

Solution 1:

In plotly, you can use scope to limit the base map that is shown. Unfortunately, out of the box, only a few scopes are available listed here: https://plot.ly/python/reference/#layout-geo-scope

To limit what is shown as the base map, there is a workaround which employs using lonaxis and lataxis as shown here: http://codepen.io/etpinard/pen/XKamdk. This issue is documented here for reference: https://github.com/plotly/plotly.js/issues/719.

To get from geoJSON to points, simple use the coordinates in geoJSON as lon and lat in your data variable. Also, if you are trying to do a scatter map of cities, you should use data type: 'scattergeo' rather than type: 'choropleth'. Here is a link to a tutorial from plotly: https://plot.ly/javascript/scatter-plots-on-maps/.

Post a Comment for "Plotly: Create Map Based On Geojson File"