Closed rahulsingh7 closed 3 years ago
Since your source is a GeoJSON FeatureCollection you have to set the property
to features
for format
in UrlData. And since the attributes of a geometry are stored within properties
within the GeoJSON definition you'll have to lookup using lookup=properties.code
data_uk =alt.UrlData("https://raw.githubusercontent.com/keto08/covid-19/master/COVID19-UK/morbidity_sensitivity.csv")
data_geojson = alt.UrlData(
url="https://raw.githubusercontent.com/keto08/covid-19/master/COVID19-UK/uk_corrected.geojson",
format=alt.DataFormat(property='features')
)
geomap = alt.Chart(data_geojson,title = 'Effect of Population Density on Morbidity')\
.mark_geoshape(stroke='black',strokeWidth=0.125)\
.encode(color= 'dPOP:Q').transform_lookup(
lookup='properties.code',
from_=alt.LookupData(data_uk, 'code', ['dPOP'])
).project('mercator')\
.properties(
width=500,
height=500)
Thanks, @mattijn , that was very helpful,..... This works for me.. Closing the bug
Transform_lookup() not working when using Two separate files for map and data.
.........Code Snippet..........
This Gives a Blank Map in Altair.