- il file geoJSON che si carica, anche se la struttura è identica, non può essere caricato direttamente nei comuni software, come geometria, ad esempio in QGis;
- logicamente, bisogna fare qualche passaggio in più;
- il codice nell'insieme può risultare confuso, perché deve essere caricato come script secondario, apparentemente slegato dal file;
- il pre-caricamento, anche se non serve, può rallentare l'applicazione;
- sempre più spesso si trovano esempi, che fanno uso del metodo spiegato in questo articolo;
I thought about this for a minute. Why wasn’t I just passing my GeoJSON file directly into jQuery’s getJSON()
method? I thought I had tried it and it hadn’t worked. But then I tried it. And it totally worked!
So let’s take a look at this code and compare it to the code I posted last month.
Passing JSON directly into getJSON method. By Lyzi.
[wc_row][wc_column size=one-half position=first]
[/wc_column][wc_column size=one-half position=last]
[/wc_column][/wc_row]
[wc_row][wc_column size=one-half position=first]
[wc_button type=primary url=https://youtu.be/e5XO5JD7lTw title=Visit Site target=self position=float]Video[/wc_button]
[/wc_column][wc_column size=one-half position=last][wc_button type=primary url=https://www.cityplanner.biz/experiment_host/leafletjs_example/index_06/index.html title=Visit Site target=self position=float]Mappa[/wc_button]
[/wc_column][/wc_row]Riferimenti per caricare Json in LeafletJS
- esempio che usa le cordinate del centro della mappa e lo zoom, al posto dei verti opposti come confini
- geojson.io è un web tool per visualizzare e modificare i file GeoJSON (meglio non caricare file superiori a 2mb)
- External GeoJSON and Leaflet: The Other Way(s)
- jQuery for mapping
- Ajax
Archiviato in GitHUB e caricato in LeafletJS come RAW
