Google Maps API map application example sharing, mapsapi

Source: Internet
Author: User
Tags export class

Google Maps API map application example sharing, mapsapi

Effect (tested in new Firefox version ):

Code:

<! DOCTYPE>
<Html>
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8">
<Title> Google Map </title>
<Script type = "text/javascript" src = "http://maps.google.com/maps/api/js? Sensor = false "> </script>
<Script type = "text/javascript">
Function init ()
{
// Obtain the current location
Navigator. geolocation. getCurrentPosition (function (position)
{
Var coords = position. coords;
// Set the map parameters and set the longitude and latitude of the current position to the center point
Var latlng = new google. maps. LatLng (coords. latitude, coords. longpolling );
Var myOptions =
{
// Magnification
Zoom: 14,
// Mark coordinates
Center: latlng,
// Map type
MapTypeId: google. maps. MapTypeId. ROADMAP
};
Var map1;
// Display the map
Map1 = new google. maps. Map (document. getElementById ('map'), myOptions );
// Create a tag
Var marker = new google. maps. Marker (
{
Position: latlng,
Map: map1
});
// Set the annotation window and attach the annotation text
Var infowindow = new google. maps. InfoWindow (
{
Content: "current location"
});
// Open the annotation window
Infowindow. open (map1, marker );
});
}
</Script>
</Head>
<Body onload = "init ()">
<Div id = "map"> </div>
</Body>
</Html>

Google Maps JavaScript API v3 (reference): https://developers.google.com/maps/documentation/javascript/basics

Baidu map API reference documents: http://developer.baidu.com/map/jsmobile.htm


The best example of some php applications on Google Maps API

This is a query area shown by GOOGLE. <iframe width = "300" height = "180" frameborder = "0" scrolling = "no" marginheight = "0" marginwidth = "0 "src =" canonical "> </iframe> if you go to GOOGLE map to display the location you are querying, the code is OK, or you can change the code above.

Android uses google maps api

You use the MapView export class for your own map application. If you want to have bubbles, you also need to use Overlay related items in Google apis to draw layers, google's built-in Maps are implemented.

Related Article

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.