add documentation how to load a local topojson file
See original GitHub issueis this pseudo code supported
import pandas as pd
import altair as alt
counties = alt.topo_feature('https://raw.githubusercontent.com/djouallah/R_leaflet_MAP/master/foundation.json', 'id')
map =alt.Chart(counties).mark_geoshape().encode(
color='id:Q'
)
map
all the documentation is using “data.world_110m.url”, how about local topojson or geojson files ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
topojson_read: Read topojson from a local file or a URL - Rdrr.io
In geojsonio: Convert Data from and to 'GeoJSON' or 'TopoJSON' · View source: R/topojson_read.R. topojson_read, R Documentation. Read topojson ...
Read more >how add a topoJSON file to a Shape Map from an Azure Blob ...
Solved: The only choice seems to be the local file system.
Read more >TopoJSON in Highcharts Maps
In order to use TopoJSON in Highcharts Maps, we must first decode it to GeoJSON. This is very simple using the TopoJSON Client...
Read more >Minify TopoJSON in the browser / Lauren Nishizaki - Observable
This is an exploration of different TopoJSON file optimizations. ... The exact property set you leave in the file (or add) are up...
Read more >geojsonio: Convert Data from and to 'GeoJSON' or 'TopoJSON'
service, and "local" means we use sf. ... The local option uses the function ... option does not document what file size is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@djouallah your problem literally solved my problem.I wanted to plot for the country India…It is sorted now
` import altair as alt
url = “https://raw.githubusercontent.com/deldersveld/topojson/master/countries/india/india-states.json”
source = alt.topo_feature(url, “IND_adm1”)
alt.Chart(source).mark_geoshape().encode( tooltip=‘properties.NAME_1:N’ ) `
I know some of TopoJSON, as 'm working on a Python package regarding this extension of GeoJSON ( https://github.com/mattijn/topojson)*. Its work in progress. but potentially to be used as an interchange format between geographical packages in the Python ecosystem (eg.
geopandas
andaltair
).Without explaining the format, you are dealing with nested objects. So in the
alt.topo_feature(url, feature)
you have to define thefeature
or layer that is present within theobjects
in your TopoJSON file.This layer or
feature
(in your case namedfoundation
) contains often multiple geometries, where each geometry refers to certain top-level stored geometric segments or so-calledarcs
. Next to the geometry, you have to store some attributes of that geometry, which is stored in another nested objectproperties
.So in order to access these attribute information you have to add
properties
to enter this nested object.Your issue have been discussed before on the Vega-repo: https://github.com/vega/vega/issues/1319 And more work has also been done in: https://iliatimofeev.github.io/gpdvega/
singledispatcher
method as was discussed in https://github.com/altair-viz/altair/issues/843, which works very well.