Closed cappelaere closed 10 years ago
This uses L.geoJson, a class that has no built-in data style constructs. Possibility of using L.mapbox.featureLayer is in #1, otherwise, the trick is to wait for .on('ready'
and then apply your custom styles.
Actually, I think this could be fixed in the code leaflet-omnivore.js:36 change to: var layer = L.geoJson(null, options); This would allow the passing of options such as onEachFeature...that could then be used for styling. Thank you for your great work. Pat.
A related question for you Tom: I want to create 4 different layers with different styling from the same topojson with multiple properties. Is there a way to do this using leaflet-omnivore? Right now I'm loading each one seperately, but this seems wasteful:
var MAP1 = omnivore.topojson(topojsonURL, null, MAP1_style);
var MAP2 = omnivore.topojson(topojsonURL, null, MAP2_style);
var MAP3 = omnivore.topojson(topojsonURL, null, MAP3_style);
var MAP4 = omnivore.topojson(topojsonURL, null, MAP4_style);
Thanks for a great tool!
Right now I'm loading each one seperately, but this seems wasteful:
If you want to just request this once, you can use jQuery for the ajax and topojson.parse. Otherwise, if your server is properly configured this should cache the first response.
I see. Makes sense. Thanks for your response!
topojsonload does not seem to read styling options that could be passed for each feature. How could this be achieved? Thanks. Pat.