1

I'm newbie in openlayers, but I have tried to add geojson from nominatim to vector layer

var vectorLayer = new ol.layer.Vector({
source: new ol.source.Vector({
    format: new ol.format.GeoJSON(),
    url: 'https://nominatim.openstreetmap.org/search.php?q=wien&polygon_geojson=1&format=json'
})
});

My problem is: Uncaught TypeError: geometryReader is not a function

1

So the TypeError you reference above typically happens when the GeoJSON data you provide lacks a recognized "type" attribute for the features.

More than likely when the reader attempts to read the features it looks at the "type" attribute of each feature - it MUST be one of the following:

GeometryCollection
LineString
MultiLineString
MultiPoint
MultiPolygon
Point
Polygon

Of course, the data from nominatim ought to be valid geojson - but perhaps there's a record it doesn't recognize for some reason or something.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.