Add GMaps link on points popups (#8)
Co-authored-by: Felipe Contreras Salinas <felipe@bstr.cl> Reviewed-on: #8
This commit is contained in:
parent
2b941a1624
commit
d7c28bfa62
1 changed files with 6 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
import * as L from 'leaflet-contextmenu';
|
import * as L from 'leaflet-contextmenu';
|
||||||
import { Feature, FeatureCollection } from 'geojson';
|
import { Feature, FeatureCollection, Point } from 'geojson';
|
||||||
|
|
||||||
interface PlaceModel {
|
interface PlaceModel {
|
||||||
id: number | null;
|
id: number | null;
|
||||||
|
|
@ -282,6 +282,11 @@ async function setupMap(): Promise<void> {
|
||||||
popupStr += "<li><b>Horario:</b> " + feature.properties.open_hours + "</li>";
|
popupStr += "<li><b>Horario:</b> " + feature.properties.open_hours + "</li>";
|
||||||
if (feature.properties.description)
|
if (feature.properties.description)
|
||||||
popupStr += "<li>" + feature.properties.description + "</li>";
|
popupStr += "<li>" + feature.properties.description + "</li>";
|
||||||
|
|
||||||
|
const lnglat = (feature.geometry as Point).coordinates;
|
||||||
|
popupStr += "<a href=\"https://www.google.com/maps/dir//" +
|
||||||
|
lnglat[1] + "," + lnglat[0] + "/@" + lnglat[1] + "," + lnglat[0] +
|
||||||
|
",15z\" target=\"_blank\">GMaps</a>"
|
||||||
popupStr += "</ul>";
|
popupStr += "</ul>";
|
||||||
|
|
||||||
layer.bindPopup(popupStr);
|
layer.bindPopup(popupStr);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue