Tuesday, January 13, 2009

Four Word Phrases For Friends

I primi controlli e metodi nell'utilizzo delle Google Maps

begin to do some work on files of the previous article to make it even more 'useful to our work.
Map of the previous post did not allow us either to move the map nor zoom controls attravero classic Google Maps. Suppose we have the need to include such controls. Suppose also that you have the need to incorporate into our site a map centered on a particular item by entering a description in the same place.
For centering the map, will be the method

map.setCenter (new GLatLng (lat, long), livellozoom)

To do this we need to know the latitude and longitude (NB in decimal format, not in degrees) of the point where we're going to center the map. To do this, or record the data from our GPS or use applications like http://mygeoposition.com/ .
Regarding the controls, you can simply use the methods

map.addControl (new GMapTypeControl ());


map.addControl (new GSmallMapControl ());

map.addControl (new GLargeMapControl ());


map.addControl (new GScaleControl ());


the first control allows you to select the type of map (Map, Satellite, Hybrid), the second and third are used to activate the navigation bar (the arrows to move) and buttons for zooming, in two versions, small and large, the fourth allows you to see the scale of our map.
Finally, with regard to the dialog box, you use the method


map.openInfoWindow (map.getCenter (), document.createTextNode ("testodavisualizzare"));


The work done so far can find here, followed by the HTML document.


\u0026lt;! DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

\u0026lt;html xmlns="http://www.w3.org/1999/xhtml">
\u0026lt;head>
\u0026lt;meta http-equiv = "content-type" content = "text / html; charset = utf- 8 "/>
\u0026lt;title> Example 2 \u0026lt;/ title>
\u0026lt;script src =" & key = http://maps.google.com/maps?file=api&v=2
ABQIAAAAynaMdsZYAs5aITp8oGFoixTaBdm2rMFwTfjoALLN-mPT1dOPXBTTmmyWoK3
otqrSo4SXBqg8UMWHOA "type =" text / javascript "> \u0026lt;/ script>

\u0026lt;script type="text/javascript">

/ / function load () {
if (GBrowserIsCompatible ()) {var map = new
GMap2 (document.getElementById ("map"));

/ / ***** Center Spezia on the map zoom level 16
map.setCenter (new GLatLng (44.111206, 9.834749), 16);

/ / ***** View Control - Zoom Piccolo
map.addControl (new GSmallMapControl ());

/ / ***** View Map Type Control
map.addControl (new GMapTypeControl ());

/ / View *****
the scale of the map map.addControl (new GScaleControl ());

/ / ***** Opens information window
map.openInfoWindow (map.getCenter (), document.createTextNode ("The house where I was born
: Italy Avenue 40, Los Angeles'));}

}


//]]> \u0026lt;/ script>
\u0026lt;/ head>
\u0026lt;body onload = "load ()" onunload = "GUnload () "> \u0026lt;div
id="map" style="width:600px;height:400px"> \u0026lt;/ div>
\u0026lt;/ body>
\u0026lt;/ html>

0 comments:

Post a Comment