Example of dash choropleth map from a postgis layer

Do you have this kind of example?

Tks in advance,

mauro

If you can get GeoJSON out of your postgis database, then you can use one of the new choroplethmapbox chart types available in Dash 1.1.1

(Many thanks to the organization that sponsored this feature :heart: (more about how to sponsor & fund our open source work: https://plot.ly/products/consulting-and-oem))

1 Like

Thanks!

I´m trying to run the GeoJSON choropleths sample. I got the error message: ValueError: Invalid property specified for object of type plotly.graph_objs.Choropleth: ‘geojson’.

The dash version I have is 0.43.0 and I’m using Anaconda, and conda install shows that as the last version.

Should I update to Dash 1.1.1? How can I do that?

Mauro Assis

Now I updated to dash 1.1.1, from github, and after that I get the following error message:

File “mapFromPostgres.py”, line 37, in
fig = go.Figure(go.Choroplethmapbox(geojson=counties, locations=unemp.fips, z=unemp.unemp,
AttributeError: module ‘plotly.graph_objects’ has no attribute ‘Choroplethmapbox’

You likely need to upgrade the plotly library as well

Ok, tks.

Shoudl I pick up from GitHub? How can I do that in Anaconda? There´s no setup.py there.

Tks!

I updated it from github (https://github.com/plotly/plotly.py) to version 4.0.0 and I get the error:

AttributeError: module ‘plotly.graph_objects’ has no attribute ‘Choroplethmapbox’

You need to upgrade to 4.1.0, which is the latest version - Changelog here: https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md#410---2019-08-06

Tks, it´s working nicely, now!

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online