Skip to content

Load TopoJson data given as a string or filename - #2353

Open
huzaifarahman13 wants to merge 1 commit into
python-visualization:mainfrom
huzaifarahman13:fix-topojson-str
Open

huzaifarahman13 wants to merge 1 commit into
python-visualization:mainfrom
huzaifarahman13:fix-topojson-str

Conversation

@huzaifarahman13

Copy link
Copy Markdown

The TopoJson docstring says data can be a str, but passing a TopoJSON string or a filename crashed on render with AttributeError: 'str' object has no attribute 'get'. Same thing happened with Choropleth(geo_data="file.json", topojson=...).

Now a string is loaded the same way GeoJson does it: inline JSON gets parsed, URLs get fetched and anything else is read as a file. I updated the docstring to match and added a test for the string and filename cases. The test fails on main and passes with this change.

TopoJson documents that data can be a str, but a TopoJSON string or a
filename was kept as-is and rendering failed with
AttributeError: 'str' object has no attribute 'get'. Load the string the
same way GeoJson does: parse inline JSON, fetch URLs and read files.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant