I have a geojson url endpoint that shows correctly in QGIS, ArcMap and using the ArcGIS Javascript API when loading, but won't when using through OpenLayers.
Currently this is the portion of my script where I am trying to load the data:
new ol.layer.Vector({
// A layer must have a title to appear in the layerswitcher
title: 'Property Parcels',
// Again set this layer as a base layer
type: 'data',
visible: true,
style: styleFunction,
source: new ol.source.Vector({
projection : 'EPSG:3857',
url: '{{url('parcels/geojson')}}',
format: new ol.format.GeoJSON()
}),
}),
Other layers load fine, but I am trying to get away from the formatting of GeoJson objects on the page and more to url endpoints.
You can find the sample geojson data here:
{
"type":"FeatureCollection",
"features":[
{
"type":"Feature",
"properties":{
"type":"parcel",
"ParcelID":"070711431009"
},
"geometry":{
"type":"MultiPolygon",
"coordinates":[
[
[
[
-104.739810985448,
40.5869690039517
],
[
-104.740242592446,
40.5869539996775
],
[
-104.740253583381,
40.5871377169226
],
[
-104.739821976404,
40.5871527203439
],
[
-104.739810985448,
40.5869690039517
]
]
]
]
}
},
And I should mention that the ajax does retrieve the response from the url, so I know it is firing, it's just not adding any features to the map.
question from:
https://stackoverflow.com/questions/65878834/remote-geojson-layer-not-appearing-in-openlayers-map 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…