Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getLatLng() {
- return $.ajax({
- url: 'https://maps.googleapis.com/maps/api/geocode/json?address=germany&sensor=false',
- type: 'GET',
- dataType: 'json',
- });
- }
- getLatLng().done(function(data) {
- var latlng = [data.results[0].geometry.location.lat, data.results[0].geometry.location.lng];
- function initMap() {
- var styledMapType = new google.maps.StyledMapType(
- [],
- {name: 'Styled Map'});
- var map = new google.maps.Map(document.getElementById('map'), {
- center: {lat: latlng[0], lng: latlng[1]},
- zoom: 11,
- mapTypeControlOptions: {
- mapTypeIds: ['roadmap', 'satellite', 'hybrid', 'terrain',
- 'styled_map']
- }
- });
- map.mapTypes.set('styled_map', styledMapType);
- map.setMapTypeId('styled_map');
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement