readFeatures method throws an error
See original GitHub issueI am experiencing an issue with OpenLayers readFeatures method. Whenever i try to include this code…
const format = new OlFormatGeoJSON();
// following line throws an error
const features = format.readFeatures(buildingsData);
… into my react-geo application, the following error message shows up:
Uncaught SyntaxError: Unexpected token / in JSON at position 0
at JSON.parse (<anonymous>)
at getObject (JSONFeature.js:216)
at GeoJSON.readFeatures (JSONFeature.js:59)
at Module../src/components/Map.js (Map.js:107)
(and many more)
I already tried to reinstall Ol and react-geo, but the error message still remains the same. My goal is to implement the AgFeatureGrid from react-geo, but i’m not sure if the problem stems from react-geo or Open Layers.
here you can find the repo.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Error reading geojson features in OpenLayers 4.6
The error gets thrown on the readFeatures method when passed the geojson. I'm open to other implementations, but I was trying to something ......
Read more >org.geotools.geojson.feature.FeatureJSON.readFeature java ...
Thrown when trying to retrieve an element past the end of an Enumeration or Iterator. ExecutorService (java.util.concurrent). An Executor that provides methods ......
Read more >Featurereader error using DB/2 via ODBC - wrong SQL syntax
I am trying to read features from a DB/2 database using an ODBC connection. This is the statement that throws an error;.
Read more >Drag and drop interaction error handling in OpenLayers
Some formats will throw an error if not caught while others fail silently, so if no format works which ... readFeatures(reader.result); .
Read more >FeatureJSON (Geotools modules 29-SNAPSHOT API)
All Methods Instance Methods Concrete Methods ... public SimpleFeature readFeature(Object input) throws IOException. Reads a feature from GeoJSON.
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
As @mike-000 pointed out,
buildingsData
holds aurl
, butreadFeatures()
expects a JSON object or string. So you’d have to change your code to something likeAt https://github.com/dmenneck/campusmap/blob/master/src/components/Map.js#L56 you use
buildingsData
as a url. It cannot be both a url and a json string.