Google Map API V3 Development (4)

Source: Internet
Author: User
Tags reverse geocoding

9 Layers

The Maps API contains several layers:

Kmllayer object for rendering KML and GeoRSS elements in the maps API V3 tile overlay.

Heatmaplayer objects that use thermal map visualization techniques to render geographic data.

A Fusiontableslayer object that renders the data contained in the Google Fusion Tables.

A Trafficlayer object that renders the layer describing the condition of the traffic and the overlay that represents the traffic.

A Transitlayer object that shows the public transport network in your city on a map.

Weatherlayer and Cloudlayer objects allow you to add weather forecasts and cloud maps to your map.

A Bicyclinglayer object that renders a layer of bike lanes in a common layer and/or a bike-specific overlay. By default, the layer is returned in Directionsrenderer when the route for Travel mode bicycling is requested.

A Panoramiolayer object that is used to add a photo from the Panoramio as a layer.

Cases:

var weatherlayer = new Google.maps.weather.WeatherLayer ({
TemperatureUnits:google.maps.weather.TemperatureUnit.FAHRENHEIT
});
Weatherlayer.setmap (map);

Ten Service

? Route Service

? Distance matrix Service

? Altitude Service

? Geo-coding Services

? Maximum Scaled image Service

? Street View Service

Route Service

You can use the Directionsservice object to calculate the route (using various modes of transportation). This object communicates with the Google Maps API routing service, which receives the route request and returns the results of the calculation. You can handle these route results yourself, or you can use the Directionsrenderer object to render these results.

You can specify the start and end of the route in the form of a text string (for example, "Illinois Chicago" or "Australian New South Wales, State Of Darwin") or a latlng value. Route services can use a series of signposts to return to a multi-segment route. The route can be displayed as a polyline that draws a route on the map, or it can be displayed as some textual description in the <div> element (for example, "Turn right on Zhongshan Road").

Distance matrix Service

Google's Distance matrix service calculates the travel distance and duration between multiple start and end points using a given travel method.

var origin1 = new Google.maps.LatLng (55.930385,-3.118425);
var origin2 = "Greenwich, England";
var Destinationa = "Stockholm, Sweden";
var destinationb = new Google.maps.LatLng (50.087692, 14.421150);

var service = new Google.maps.DistanceMatrixService ();
Service.getdistancematrix (
{
Origins: [Origin1, Origin2],
Destinations: [Destinationa, Destinationb],
TravelMode:google.maps.TravelMode.DRIVING,
Avoidhighways:false,
Avoidtolls:false
}, callback);

function callback (response, status) {
See parsing the Results for the basics of a callback function.
}

Altitude Service

The elevation service provides elevation data for the Earth's surface location, including the depths of the seabed (return negative values). In these cases, Google cannot provide accurate altitude measurements for the exact location you requested, which will insert and return an average of four nearest positions.

function Getelevation (event) {
var locations = [];
var clickedlocation = event.latlng;
Locations.push (clickedlocation);
var positionalrequest = {
' Locations ': locations
}
Initiate the location request
Elevator.getelevationforlocations (positionalrequest, function (results, status) {
if (status = = Google.maps.ElevationStatus.OK) {

Retrieve the first result
if (Results[0]) {

Do something
} else {
Alert ("No results found");
}
} else {
Alert ("Elevation service failed due to:" + status);
}
});
}

Geo-coding Services

Geocoding is the process of converting addresses (such as "Amphitheatre Parkway, Mountain View, CA") to geographic coordinates such as latitude 37.423021 and longitude-122.083739, where you can place markers or locate maps.

Conversely, converting a location on a map to an easy-to-understand address is called "Reverse geocoding."

Maximum Scaled image Service

The Google maps API provides a variety of map tiles of different zoom levels for map type images. Most road map images have a zoom level of 0 to 18 (for example). Satellite images are scaled more broadly because they are not system-generated and are taken directly.

In some remote areas (sparsely populated areas or high seas) satellite imagery does not always provide a higher zoom level, so you need to know the highest zoom level of the image at the specified location in advance. The Maxzoomservice object provides a simple interface for you to see the maximum zoom level for a given location that Google maps provides satellite imagery for.

function Showmaxzoom (e) {
MAXZOOMSERVICE.GETMAXZOOMATLATLNG (E.LATLNG, function (response) {
if (response.status! = Google.maps.MaxZoomStatus.OK) {
Alert ("Error in Maxzoomservice");
Return
} else {
Alert ("The maximum zoom at this location is:" + response.zoom);
}
Map.setcenter (E.LATLNG);
});
}

Street View Service

Google Street View provides a 360-degree panoramic view of the entire coverage range from the specified road.

var panoramaoptions = {
Position:fenway,
POV: {
Heading:34,
Pitch:10,
Zoom:1
}
};
var panorama = new Google.maps.StreetViewPanorama (document.getElementById ("Pano"), panoramaoptions);
Map.setstreetview (Panorama);

Google Map API V3 Development (4)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.