Add GMaps link on points popups #8
1 changed files with 6 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import * as L from 'leaflet-contextmenu';
|
||||
import { Feature, FeatureCollection } from 'geojson';
|
||||
import { Feature, FeatureCollection, Point } from 'geojson';
|
||||
|
||||
interface PlaceModel {
|
||||
id: number | null;
|
||||
|
|
@ -282,6 +282,11 @@ async function setupMap(): Promise<void> {
|
|||
popupStr += "<li><b>Horario:</b> " + feature.properties.open_hours + "</li>";
|
||||
if (feature.properties.description)
|
||||
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>";
|
||||
|
||||
layer.bindPopup(popupStr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue