[GIS] OpenLayers 3 GeoJSON not loading

geojsonopenlayers

I am having trouble loading a GeoJSON layer (below is my defintion). Everything works fine when I read the file locally in a web browser, e.g. file:///Z:/inetpub/wwwroot/bang.html. However, when I try to access the site through the domain, e.g www.daverules.com/bang.html, none of my GeoJSON layers show up.

It should also bear mentioning that I have a couple of Leaflet maps that will load GeoJSON with similar URLs without issue.

var wellsLayer = new ol.layer.Vector({
  source: new ol.source.GeoJSON({
    projection: 'EPSG:3857',
    url: "./data/WELLS.geojson"
  }),
  name: 'Wells',
  style: customStyleFunction
});

Response from the server is as follows. It shows file not found, however, I am pretty sure it is there.

GET http://daverules.com/data/WELLS.geojson 404 (Not Found)

Best Answer

Hopefully the better I get at this the fewer questions I will answer myself. after doing some research I found the solution here

apparently there was no mimetype for geojson so the server wasn't putting it out there. here are the steps.

  1. Open IIS Manager
  2. head over to the properties of the IIS Server and click MIME Types
  3. add this: extension: geojson MIME type application/json
Related Question