[GIS] Using URL of JSON file on local drive with OpenLayers support

javascriptjsonopenlayers-2

When i save json file in web apps then using http://localhost:8080/WGSClient/js/object.json this path file gets open.

But when i keep it outside web apps like local folder then using same url format json file is not accessible.

It showing error that OpenLayers doesn't support this url format.

So what is the proper url which OpenLayers support or i should keep my json file in web apps?

What would be the URL of a JSON file on the local drive?

Best Answer

Do you mean file URIs? You can try the following format

file://host/path

For example, if you want the file fstab at /etc/

file://localhost/etc/fstab

You can also omit the host but don't omit the slash

file:///etc/fstab

I hope that helps.

Related Question