Geographos
Geographos

Reputation: 1496

Link from localhost geoJSON file to local file directory

I would like to load data from local file into GeoJSON/JSON placed on localhost.

According to query below:

https://gis.stackexchange.com/questions/331746/how-to-write-hyperlinks-to-local-files-in-geojson-properties/331754#331754

it can be easily done, although only in offline conditions.

If you have your file on localhost it works completely different.

First of all, the code:

"URL": "File directory"

is not working at all.

Because the code presented above is a part of single GeoJSON/JSON placemark, some solutions presented below:

Loading file from local directory?

https://www.html5rocks.com/en/tutorials/file/dndfiles/

Loading file from local directory?

cannot be applied to my query, because I want to fetch an internal JSON link feature instead of loading a whole file.

I was trying something like this:

"URL": "<a href='../../../../file://///Z:\\Fixed Line\\Design & Build\\2. Clients\\Openreach\\3. MDU Designs\\Coventry\\OR66 - Priory Court, Coventry\\'<a>File directory</a>"

backing to main MyPC directory, according to the existing folder path: C/Wampp/www/work/07...

but unfortunately I got an error (in the image below) despite a right path provided.

Is any way to fetch the local file GeoJSON/JSON url in localhost? Likewise in the link below?:

https://gis.stackexchange.com/questions/331746/how-to-write-hyperlinks-to-local-files-in-geojson-properties/331754#331754

And also could it be opened by WIndows application instead of the web browser?enter image description here

Upvotes: 1

Views: 703

Answers (1)

Geographos
Geographos

Reputation: 1496

An answer is:

Instead of:

<a href='../../../../file://///Z:\\Fixed Line\\Design & Build\\2. Clients\\Openreach\\3. MDU Designs\\Coventry\\OR66 - Priory Court, Coventry\\'<a>File directory</a>

or

<a href='file://///Z:\\Fixed Line\\Design & Build\\2. Clients\\Openreach\\3. MDU Designs\\Coventry\\OR66 - Priory Court, Coventry\\'<a>File directory</a>

we must write:

<a href='file://localhost/Z:\\Fixed Line\\Design & Build\\2. Clients\\Openreach\\3. MDU Designs\\Coventry\\OR66 - Priory Court, Coventry\\'<a>Local directory</a>

placing our localhost folder as a first.

However it's not all! Depends on the browser you may have this URL blocked.

For someone, who use Google Chrome like me, essential is installation of the "Enable local file links" plugin available here:

https://chrome.google.com/webstore/detail/enable-local-file-links/nikfmfgobenbhmocjaaboihbeocackld?hl=en

Then you should get the local directory path shown in your browser.

Upvotes: 1

Related Questions