Added google maps

This commit is contained in:
2019-09-02 22:58:23 -04:00
parent c56451c8d0
commit a3bdfed596
9 changed files with 45 additions and 2 deletions

View File

@@ -7,6 +7,10 @@ declare const L;
export enum MapLayers {
BING,
GOOGLE_HYBRID,
GOOGLE_ROAD,
GOOGLE_SATELLITE,
GOOGLE_TERRAIN,
ESRI_TOPOGRAPHIC,
ESRI_IMAGERY,
ESRI_IMAGERY_CLARITY
@@ -156,11 +160,23 @@ export class MapService {
setMapLayer(layer?: MapLayers) {
if(this.mapLayer) this.map.removeLayer(this.mapLayer);
if(layer == null) layer = MapLayers.BING;
if(layer == null) layer = MapLayers.GOOGLE_HYBRID;
switch(layer) {
case MapLayers.BING:
this.mapLayer = L.tileLayer.bing(environment.bing);
break;
case MapLayers.GOOGLE_HYBRID:
this.mapLayer = L.gridLayer.googleMutant({type: 'hybrid'});
break;
case MapLayers.GOOGLE_ROAD:
this.mapLayer = L.gridLayer.googleMutant({type: 'roadmap'});
break;
case MapLayers.GOOGLE_SATELLITE:
this.mapLayer = L.gridLayer.googleMutant({type: 'satellite'});
break;
case MapLayers.GOOGLE_TERRAIN:
this.mapLayer = L.gridLayer.googleMutant({type: 'terrain'});
break;
case MapLayers.ESRI_TOPOGRAPHIC:
this.mapLayer = L.esri.basemapLayer('Topographic');
break;

View File

@@ -55,7 +55,11 @@ export class MapComponent implements OnDestroy, OnInit {
{name: 'Place Relative', icon: 'control_camera', click: this.placeRelative},
{name: 'Delete', icon: 'delete', toggle: true, onEnabled: this.startDelete, onDisabled: this.unsub},
{name: 'Map Style', icon: 'terrain', subMenu: [
{name: 'Bing:Satellite', toggle: true, enabled: true, click: () => this.map.setMapLayer(MapLayers.BING)},
{name: 'Bing:Satellite', toggle: true, click: () => this.map.setMapLayer(MapLayers.BING)},
{name: 'Google:Hybrid', toggle: true, enabled: true, click: () => this.map.setMapLayer(MapLayers.GOOGLE_HYBRID)},
{name: 'Google:Road', toggle: true, click: () => this.map.setMapLayer(MapLayers.GOOGLE_ROAD)},
{name: 'Google:Satellite', toggle: true, click: () => this.map.setMapLayer(MapLayers.GOOGLE_SATELLITE)},
{name: 'Google:Terrain', toggle: true, click: () => this.map.setMapLayer(MapLayers.GOOGLE_TERRAIN)},
{name: 'ESRI:Topographic', toggle: true, click: () => this.map.setMapLayer(MapLayers.ESRI_TOPOGRAPHIC)},
{name: 'ESRI:Satellite', toggle: true, click: () => this.map.setMapLayer(MapLayers.ESRI_IMAGERY)},
{name: 'ESRI:Satellite Clear', toggle: true, click: () => this.map.setMapLayer(MapLayers.ESRI_IMAGERY_CLARITY)}