-1
Following exactly the example of the openlayers site in:
https://openlayers.org/en/latest/examples/box-selection.html?q=feature
Locally, I have the following error:
Uncaught SyntaxError: Unexpected token <in JSON at position 0
at JSON.parse (<anonymous>)
at getObject (JSONFeature.js: 197)
at GeoJSON.JSONFeature.readFeatures (JSONFeature.js: 53)
at VectorSource. <anonymous> (featureloader.js: 94)
I believe the error occurs when trying to load a geojson file locally.
var vectorSource = new VectorSource ({
url: 'data / geojson / countries.geojson',
format: new GeoJSON ()
});
countries.geojson as it is quite extensive, I leave the link from where I downloaded the file: https://r68tk.csb.app/data/geojson/countries.geojson
How to solve?
How to post the code of your file
countries.geojson
?– leofalmeida
leofalmeida , as a file is very large, I leave the link: https://r68tk.csb.app/data/geojson/countries.geojson
– Fabio Sodre