Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

openstreetmap api example javascript

// Where you want to render the map.
var element = document.getElementById('osm-map');

// Height has to be set. You can do this in CSS too.
element.style = 'height:300px;';

// Create Leaflet map on map element.
var map = L.map(element);

// Add OSM tile layer to the Leaflet map.
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

// Target's GPS coordinates.
var target = L.latLng('47.50737', '19.04611');

// Set map's center to target with zoom 14.
map.setView(target, 14);

// Place a marker on the same location.
L.marker(target).addTo(map);
Comment

PREVIOUS NEXT
Code Example
Javascript :: useref array 
Javascript :: before in javascript 
Javascript :: sequelize db:create test environment 
Javascript :: regex exact match 
Javascript :: javascript parseInt() method 
Javascript :: jquery select 
Javascript :: javascript for each 
Javascript :: put image in canvas with cover mode 
Javascript :: vue method 
Javascript :: server mail 
Javascript :: angular add ellipsis to template string 
Javascript :: array last element 
Javascript :: how to install react fullpage using npm 
Javascript :: react native update app from play store ios app store 
Javascript :: how to make a vertical array js 
Javascript :: postman environment variable 
Javascript :: delete array 
Javascript :: login with facebook expo react native 
Javascript :: call a javascript function at a specific time of day 
Javascript :: uppercase 
Javascript :: how to start react project on atom 
Javascript :: how to decode jwt token at frontend 
Javascript :: date match mongodb 
Javascript :: async await nodejs 
Javascript :: how to disable button if errors object isnt empty in react hook form 
Javascript :: sort array of objects javascript by properties value 
Javascript :: computed property names 
Javascript :: luxy js 
Javascript :: google maps address autocomplete in angular npm 
Javascript :: devtool google 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =