Category : openstreetmap

I am using Leaflet and routing.control to show a route, the route is A to B on road, but I need to calculate some points in the middle of the route generated. The code I am using to generate the route is the following: this.arrRoutesLatLng[0] = this.createLatLng(this.loc_origen.latitud, this.loc_origen.longitud); this.arrRoutesLatLng[1] = this.createLatLng(this.loc_destino.latitud, this.loc_destino.longitud); // Crear la ..

Read more

I have to create the leaflet map where I have used the angular formly . and I have created the custom component for leaflet map as leaflet.component.ts import { Component, OnInit } from ‘@angular/core’; declare let L: any @Component({ selector: ‘app-root’, templateUrl: ‘./app.component.html’, styleUrls: [‘./app.component.css’] }) export class LeafletComponent implements OnInit { constructor() { } ..

Read more

I have created the leaflet open street map given below. .component.ts map = L.map(‘map’).setView([12.876, 80.599], 12); L.tileLayer(‘https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png’, { attribution: ‘© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors’ }).addTo(map); I have Placed the map in html page as given below .component.html <div class ="row"> <div class="col-xs-12 col-sm-8 col-lg-7"> <div id="map"></div> </div> </div> And mentioned the height in css as .component.css ..

Read more

I have created the map using leaflet open street map. And I have got the latitude and longitude by using the below function in service Now I want to get the location(city name)from that latitude and longitude. .service.ts getPosition(): Promise<any> { return new Promise((resolve, reject) => { navigator.geolocation.getCurrentPosition(resp => { resolve({ lng: resp.coords.longitude, lat: resp.coords.latitude ..

Read more