WBA2-Team24 / WBA2-Team24-SoSe14

0 stars 0 forks source link

Google Maps API #2

Open NRose opened 10 years ago

NRose commented 10 years ago

https://developers.google.com/maps/documentation/geocoding/?hl=de

NRose commented 10 years ago

var map; var geocoder = null; geocoder = new google.maps.Geocoder();

function initialize() { var mapOptions = { zoom: 11, center: new google.maps.LatLng(breitengrad, längegrad), mapTypeControl: false, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.LARGE }, streetViewControl: false, scrollwheel: false, mapTypeId: google.maps.MapTypeId.ROADMAP };

map = new google.maps.Map(document.getElementById('map'), mapOptions);

}

function doSearch() {

address = document.getElementById("search_input").value;

geocoder.geocode( { 'address': address}, function(results, status) { 
    if (status == google.maps.GeocoderStatus.OK) { 
        map.setCenter(results[0].geometry.location);
        map.setZoom(13);
    } 
    else{
        var request = new XMLHttpRequest();
        request.open('GET', 'http://localhost:3000/get/json);
        request.onload = function(){
            doResolutionSearch(JSON.parse(this.responseText), address);
        };
        request.send();
    }
});

}

NRose commented 10 years ago

Route zeichnen auf der Map: https://developers.google.com/maps/documentation/javascript/overlays?hl=de#Polylines mit entfernung berechnen: http://www.freemaptools.com/how-far-is-it-between.htm

svbr commented 10 years ago

Ist das hier hilfreich? http://www.dreamdealer.nl/tutorials/getting_directions_with_google_maps.html