1

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)
  • you should monitor network activity either through a browser's developer tools or fiddler/equivalent and see how far your geoJSON request gets. If the response completes just fine this is worth adding to your question – tomfumb Dec 16 '14 at 19:36
  • thank you for your response. the console is giving me a 404 not found however the path appears to be correct. it shows www.daveisawesome.com/data/wells.geojson as the url. I can also load the file locally through the browser. – dave_does_not_understand Dec 16 '14 at 19:49
  • I hate to say this, but your browser knows better. If it says, 404, it's a 404. In the sentence the path appears to be correct, the operative word, is almost certainly "appears", unless you are using IE5 or 6, in which case, I take it all back. – John Powell Dec 16 '14 at 19:56
  • Your link in your edited question redirects to one of those buy this domain holding pages. Not a MultiPolygon in sight, sadly, though plenty of Russian mail order brides. – John Powell Dec 16 '14 at 20:00
  • I am trying to mask it as its some proprietary data. buts good to know I can pick up some russian brides somewhere, you never know you are going to need one. Also, Messi for the ballon d'or. always. – dave_does_not_understand Dec 16 '14 at 20:06
1

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
  • Another solution for those who don't have full admin rights on their server is to rename the .geojson file to .js. – HeyOverThere Jul 6 '15 at 14:26

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.