How to write hyperlinks to local files in GeoJSON properties?Clickable hyperlink from GeoJSON field in featureHow to make a displayed geoJson property a link to another property in a Leaflet popupGeoJSON opening hyperlink to local file in the local aplication instead of browserSelect independent objects using GEOJson on OpenlayersSelecting feature programmatically from GeoJSON using OpenLayers?Loading GEOJSON in Leaflet and separating attributesMarkerCluster don't work with geojson layer in leafletChange style of GeoJSON circle marker by feature propertiesLeaflet L.geoJSON from a js variable geojson object not showing on mapHow to append geojson file using featureselectionGet GeoJSON from a database by the AJAX method for OpenLayers
Do beef farmed pastures net remove carbon emissions?
Is it legal for a company to enter an agreement not to hire employees from another company?
Are differences between uniformly distributed numbers uniformly distributed?
How much maintenance time did it take to make an F4U Corsair ready for another flight?
Is there any way to stop a user from creating executables and running them?
How do some PhD students get 10+ papers? Is that what I need for landing good faculty position?
Does the Fireball spell damage objects?
How to describe accents?
Annotating a table with arrows
Why does the standard fingering / strumming for a D maj chord leave out the 5th string?
Why are Tucker and Malcolm not dead?
Why did I get only 5 points even though I won?
What is a good class if we remove subclasses?
A Word/Phrase for the Process of Classifying Something as a Sin
Can a PC use the Levitate spell to avoid movement speed reduction from exhaustion?
Submitting a new paper just after another was accepted by the same journal
Generate Brainfuck for the numbers 1–255
Understanding the point of a kölsche Witz
What ability do tools use?
How would timezones work on a planet 100 times the size of our Earth
Can the ground attached to neutral fool a receptacle tester?
How far did Gandalf and the Balrog drop from the bridge in Moria?
Why did Gandalf use a sword against the Balrog?
How does "Te vas a cansar" mean "You're going to get tired"?
How to write hyperlinks to local files in GeoJSON properties?
Clickable hyperlink from GeoJSON field in featureHow to make a displayed geoJson property a link to another property in a Leaflet popupGeoJSON opening hyperlink to local file in the local aplication instead of browserSelect independent objects using GEOJson on OpenlayersSelecting feature programmatically from GeoJSON using OpenLayers?Loading GEOJSON in Leaflet and separating attributesMarkerCluster don't work with geojson layer in leafletChange style of GeoJSON circle marker by feature propertiesLeaflet L.geoJSON from a js variable geojson object not showing on mapHow to append geojson file using featureselectionGet GeoJSON from a database by the AJAX method for OpenLayers
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am wondering how to make a hyperlink from GeoJSON file properties to the local drive file.
I found two options here:
Clickable hyperlink from GeoJSON field in feature
this option refers to a whole .geojson file, whereas I need to have an unique hyperlink for every single object property included in this file
This option:
How to make a displayed geoJson property a link to another property in a Leaflet popup
Looks better, but I have problems with implementation it into my code, that looks:
var church = L.geoJSON(test,
pointToLayer: function(feature, latlng)
feature.properties.myKey =
feature.properties.Title + ", " + feature.properties.Head;
return L.circleMarker(latlng, geojsonMarkerOptions2);
,
onEachFeature: function(feature, layer)
layer.bindPopup(
'<h1><u><font color="red">' +
feature.properties.Title +
"</h1></u></font><h2>Address: " +
feature.properties.Head +
"</h2><p>" +
feature.properties.Description +
"</p><a href='" +
feature.properties.URL +
"'>"
);
).addTo(map);
Once I put a single link in GeoJSON file property, then works fine:
"type": "FeatureCollection",
"features": [
"type": "Feature",
"properties":
"Title": "Sitec IS",
"Head": "7400 Beach Drive",
"Description": "Gavin Sinclair"
,
"geometry":
"type": "Point",
"coordinates": [0.16964435577392578, 52.29220753602784]
,
"type": "Feature",
"properties":
"Title": "JHG",
"Head": "Shortstanton sidings",
"Description": "Conor Murphy",
"URL": "<a href='https://www.johnhenrygroup.co.uk/' target='blank'>JHG</a>"
,
"geometry":
"type": "Point",
"coordinates": [0.05458831787109375, 52.29163006501503]
]
However I would like to have a path to my local file instead of URL...
"type": "FeatureCollection",
"features": [
"type": "Feature",
"properties":
"Title": "Priory Court",
"Head": "188 Albany Road",
"Description": "MDU",
"URL": "file:\Z:Fixed LineDesign & Build2. ClientsOpenreach3. MDU DesignsCoventryOR66 - Priory Court, Coventry"
,
"geometry":
"type": "Point",
"coordinates": [-1.530101, 52.400199]
,
"type": "Feature",
"properties":
"Title": "Stretham house",
"Head": "Flat to leave",
"Description": "N/A"
,
"geometry":
"type": "Point",
"coordinates": [0.211212, 52.344149]
]
but the code doesn't work at all.
I believe, that problem lies somewhere in the apostrophs/quotation marks. I have an empty text instead or nothing.
Is there some option to make the hyperlink towards a specified path in the local drive file/folder, analogically i.e to the MS Excel?

leaflet javascript geojson hyperlink
add a comment |
I am wondering how to make a hyperlink from GeoJSON file properties to the local drive file.
I found two options here:
Clickable hyperlink from GeoJSON field in feature
this option refers to a whole .geojson file, whereas I need to have an unique hyperlink for every single object property included in this file
This option:
How to make a displayed geoJson property a link to another property in a Leaflet popup
Looks better, but I have problems with implementation it into my code, that looks:
var church = L.geoJSON(test,
pointToLayer: function(feature, latlng)
feature.properties.myKey =
feature.properties.Title + ", " + feature.properties.Head;
return L.circleMarker(latlng, geojsonMarkerOptions2);
,
onEachFeature: function(feature, layer)
layer.bindPopup(
'<h1><u><font color="red">' +
feature.properties.Title +
"</h1></u></font><h2>Address: " +
feature.properties.Head +
"</h2><p>" +
feature.properties.Description +
"</p><a href='" +
feature.properties.URL +
"'>"
);
).addTo(map);
Once I put a single link in GeoJSON file property, then works fine:
"type": "FeatureCollection",
"features": [
"type": "Feature",
"properties":
"Title": "Sitec IS",
"Head": "7400 Beach Drive",
"Description": "Gavin Sinclair"
,
"geometry":
"type": "Point",
"coordinates": [0.16964435577392578, 52.29220753602784]
,
"type": "Feature",
"properties":
"Title": "JHG",
"Head": "Shortstanton sidings",
"Description": "Conor Murphy",
"URL": "<a href='https://www.johnhenrygroup.co.uk/' target='blank'>JHG</a>"
,
"geometry":
"type": "Point",
"coordinates": [0.05458831787109375, 52.29163006501503]
]
However I would like to have a path to my local file instead of URL...
"type": "FeatureCollection",
"features": [
"type": "Feature",
"properties":
"Title": "Priory Court",
"Head": "188 Albany Road",
"Description": "MDU",
"URL": "file:\Z:Fixed LineDesign & Build2. ClientsOpenreach3. MDU DesignsCoventryOR66 - Priory Court, Coventry"
,
"geometry":
"type": "Point",
"coordinates": [-1.530101, 52.400199]
,
"type": "Feature",
"properties":
"Title": "Stretham house",
"Head": "Flat to leave",
"Description": "N/A"
,
"geometry":
"type": "Point",
"coordinates": [0.211212, 52.344149]
]
but the code doesn't work at all.
I believe, that problem lies somewhere in the apostrophs/quotation marks. I have an empty text instead or nothing.
Is there some option to make the hyperlink towards a specified path in the local drive file/folder, analogically i.e to the MS Excel?

leaflet javascript geojson hyperlink
add a comment |
I am wondering how to make a hyperlink from GeoJSON file properties to the local drive file.
I found two options here:
Clickable hyperlink from GeoJSON field in feature
this option refers to a whole .geojson file, whereas I need to have an unique hyperlink for every single object property included in this file
This option:
How to make a displayed geoJson property a link to another property in a Leaflet popup
Looks better, but I have problems with implementation it into my code, that looks:
var church = L.geoJSON(test,
pointToLayer: function(feature, latlng)
feature.properties.myKey =
feature.properties.Title + ", " + feature.properties.Head;
return L.circleMarker(latlng, geojsonMarkerOptions2);
,
onEachFeature: function(feature, layer)
layer.bindPopup(
'<h1><u><font color="red">' +
feature.properties.Title +
"</h1></u></font><h2>Address: " +
feature.properties.Head +
"</h2><p>" +
feature.properties.Description +
"</p><a href='" +
feature.properties.URL +
"'>"
);
).addTo(map);
Once I put a single link in GeoJSON file property, then works fine:
"type": "FeatureCollection",
"features": [
"type": "Feature",
"properties":
"Title": "Sitec IS",
"Head": "7400 Beach Drive",
"Description": "Gavin Sinclair"
,
"geometry":
"type": "Point",
"coordinates": [0.16964435577392578, 52.29220753602784]
,
"type": "Feature",
"properties":
"Title": "JHG",
"Head": "Shortstanton sidings",
"Description": "Conor Murphy",
"URL": "<a href='https://www.johnhenrygroup.co.uk/' target='blank'>JHG</a>"
,
"geometry":
"type": "Point",
"coordinates": [0.05458831787109375, 52.29163006501503]
]
However I would like to have a path to my local file instead of URL...
"type": "FeatureCollection",
"features": [
"type": "Feature",
"properties":
"Title": "Priory Court",
"Head": "188 Albany Road",
"Description": "MDU",
"URL": "file:\Z:Fixed LineDesign & Build2. ClientsOpenreach3. MDU DesignsCoventryOR66 - Priory Court, Coventry"
,
"geometry":
"type": "Point",
"coordinates": [-1.530101, 52.400199]
,
"type": "Feature",
"properties":
"Title": "Stretham house",
"Head": "Flat to leave",
"Description": "N/A"
,
"geometry":
"type": "Point",
"coordinates": [0.211212, 52.344149]
]
but the code doesn't work at all.
I believe, that problem lies somewhere in the apostrophs/quotation marks. I have an empty text instead or nothing.
Is there some option to make the hyperlink towards a specified path in the local drive file/folder, analogically i.e to the MS Excel?

leaflet javascript geojson hyperlink
I am wondering how to make a hyperlink from GeoJSON file properties to the local drive file.
I found two options here:
Clickable hyperlink from GeoJSON field in feature
this option refers to a whole .geojson file, whereas I need to have an unique hyperlink for every single object property included in this file
This option:
How to make a displayed geoJson property a link to another property in a Leaflet popup
Looks better, but I have problems with implementation it into my code, that looks:
var church = L.geoJSON(test,
pointToLayer: function(feature, latlng)
feature.properties.myKey =
feature.properties.Title + ", " + feature.properties.Head;
return L.circleMarker(latlng, geojsonMarkerOptions2);
,
onEachFeature: function(feature, layer)
layer.bindPopup(
'<h1><u><font color="red">' +
feature.properties.Title +
"</h1></u></font><h2>Address: " +
feature.properties.Head +
"</h2><p>" +
feature.properties.Description +
"</p><a href='" +
feature.properties.URL +
"'>"
);
).addTo(map);
Once I put a single link in GeoJSON file property, then works fine:
"type": "FeatureCollection",
"features": [
"type": "Feature",
"properties":
"Title": "Sitec IS",
"Head": "7400 Beach Drive",
"Description": "Gavin Sinclair"
,
"geometry":
"type": "Point",
"coordinates": [0.16964435577392578, 52.29220753602784]
,
"type": "Feature",
"properties":
"Title": "JHG",
"Head": "Shortstanton sidings",
"Description": "Conor Murphy",
"URL": "<a href='https://www.johnhenrygroup.co.uk/' target='blank'>JHG</a>"
,
"geometry":
"type": "Point",
"coordinates": [0.05458831787109375, 52.29163006501503]
]
However I would like to have a path to my local file instead of URL...
"type": "FeatureCollection",
"features": [
"type": "Feature",
"properties":
"Title": "Priory Court",
"Head": "188 Albany Road",
"Description": "MDU",
"URL": "file:\Z:Fixed LineDesign & Build2. ClientsOpenreach3. MDU DesignsCoventryOR66 - Priory Court, Coventry"
,
"geometry":
"type": "Point",
"coordinates": [-1.530101, 52.400199]
,
"type": "Feature",
"properties":
"Title": "Stretham house",
"Head": "Flat to leave",
"Description": "N/A"
,
"geometry":
"type": "Point",
"coordinates": [0.211212, 52.344149]
]
but the code doesn't work at all.
I believe, that problem lies somewhere in the apostrophs/quotation marks. I have an empty text instead or nothing.
Is there some option to make the hyperlink towards a specified path in the local drive file/folder, analogically i.e to the MS Excel?

leaflet javascript geojson hyperlink
leaflet javascript geojson hyperlink
edited 8 hours ago
IvanSanchez
6,9221 gold badge10 silver badges22 bronze badges
6,9221 gold badge10 silver badges22 bronze badges
asked 9 hours ago
Mariusz KrukarMariusz Krukar
287 bronze badges
287 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Couple of subtly wrong things here.
A
fileURL starts withfile:///, not withfile:\, as per the WhatWG URL specificationBackslashes in JSON must be escaped (from
to\), as explained in this answer on stackoverflow
Therefore, you should replace...
"properties":
"URL": "file:\Z:Fixed LineDesign ..."
,
...with something like...
"properties":
"URL": "file:///Z:\Fixed Line\Design ..."
,
Note that, because it's a escaped string, doing a console.log(feature.properties.URL) will output file:///Z:Fixed LineDesign....
Also note that, because of how you're concatenating strings together at...
layer.bindPopup("<a href='" + feature.properties.URL + "'>");
...things will fail if your filenames contain quotes or double quotes. Consider using encodeURI() (don't forget to check the reference), e.g.:
layer.bindPopup("<a href='" + encodeURI(feature.properties.URL) + "'>");
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f331746%2fhow-to-write-hyperlinks-to-local-files-in-geojson-properties%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Couple of subtly wrong things here.
A
fileURL starts withfile:///, not withfile:\, as per the WhatWG URL specificationBackslashes in JSON must be escaped (from
to\), as explained in this answer on stackoverflow
Therefore, you should replace...
"properties":
"URL": "file:\Z:Fixed LineDesign ..."
,
...with something like...
"properties":
"URL": "file:///Z:\Fixed Line\Design ..."
,
Note that, because it's a escaped string, doing a console.log(feature.properties.URL) will output file:///Z:Fixed LineDesign....
Also note that, because of how you're concatenating strings together at...
layer.bindPopup("<a href='" + feature.properties.URL + "'>");
...things will fail if your filenames contain quotes or double quotes. Consider using encodeURI() (don't forget to check the reference), e.g.:
layer.bindPopup("<a href='" + encodeURI(feature.properties.URL) + "'>");
add a comment |
Couple of subtly wrong things here.
A
fileURL starts withfile:///, not withfile:\, as per the WhatWG URL specificationBackslashes in JSON must be escaped (from
to\), as explained in this answer on stackoverflow
Therefore, you should replace...
"properties":
"URL": "file:\Z:Fixed LineDesign ..."
,
...with something like...
"properties":
"URL": "file:///Z:\Fixed Line\Design ..."
,
Note that, because it's a escaped string, doing a console.log(feature.properties.URL) will output file:///Z:Fixed LineDesign....
Also note that, because of how you're concatenating strings together at...
layer.bindPopup("<a href='" + feature.properties.URL + "'>");
...things will fail if your filenames contain quotes or double quotes. Consider using encodeURI() (don't forget to check the reference), e.g.:
layer.bindPopup("<a href='" + encodeURI(feature.properties.URL) + "'>");
add a comment |
Couple of subtly wrong things here.
A
fileURL starts withfile:///, not withfile:\, as per the WhatWG URL specificationBackslashes in JSON must be escaped (from
to\), as explained in this answer on stackoverflow
Therefore, you should replace...
"properties":
"URL": "file:\Z:Fixed LineDesign ..."
,
...with something like...
"properties":
"URL": "file:///Z:\Fixed Line\Design ..."
,
Note that, because it's a escaped string, doing a console.log(feature.properties.URL) will output file:///Z:Fixed LineDesign....
Also note that, because of how you're concatenating strings together at...
layer.bindPopup("<a href='" + feature.properties.URL + "'>");
...things will fail if your filenames contain quotes or double quotes. Consider using encodeURI() (don't forget to check the reference), e.g.:
layer.bindPopup("<a href='" + encodeURI(feature.properties.URL) + "'>");
Couple of subtly wrong things here.
A
fileURL starts withfile:///, not withfile:\, as per the WhatWG URL specificationBackslashes in JSON must be escaped (from
to\), as explained in this answer on stackoverflow
Therefore, you should replace...
"properties":
"URL": "file:\Z:Fixed LineDesign ..."
,
...with something like...
"properties":
"URL": "file:///Z:\Fixed Line\Design ..."
,
Note that, because it's a escaped string, doing a console.log(feature.properties.URL) will output file:///Z:Fixed LineDesign....
Also note that, because of how you're concatenating strings together at...
layer.bindPopup("<a href='" + feature.properties.URL + "'>");
...things will fail if your filenames contain quotes or double quotes. Consider using encodeURI() (don't forget to check the reference), e.g.:
layer.bindPopup("<a href='" + encodeURI(feature.properties.URL) + "'>");
answered 8 hours ago
IvanSanchezIvanSanchez
6,9221 gold badge10 silver badges22 bronze badges
6,9221 gold badge10 silver badges22 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f331746%2fhow-to-write-hyperlinks-to-local-files-in-geojson-properties%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown