gmap3 - version 7.2
5 stars based on
The map object has a range of methods and properties that you can use to work with it and there are a range of auxiliary google maps setoptions example which are designed to make it all easier. For example, the map's SetCenter method will move the map location to the specified latitude and longitude.
In turn the latitude and longitude are specified as a suitably initialised LatLng object which we have already used in the first google maps setoptions example.
You can adjust all of the other viewing parameters using similar methods and google maps setoptions example — just check the online documentation. For example there is a setOptions and a setZoom method and so on. To try this out change the button's click event handler to read:. Moving on from simply panning, zooming and generally controlling the map view it is also possible to add pushpin markers.
This is just a matter of creating a Marker object google maps setoptions example customising it using its options object. The options object has a google maps setoptions example of possible fields google maps setoptions example you have to specify position. The map field specifies the map object that the Marker is added to. This approach allows you to keep a reference to a marker and hence change them after they have been created and add them to the map when you are ready.
On the subject of changing Markers - it is worth noting that Markers are fixed by default which means that a user cannot modify your placement by dragging. You can use a custom graphic for the push pin simply by setting the setIcon method to a URL that designates the file to be loaded. MarkerImages are more versatile than simple Markers and you can use them to create markers that are have custom hotspots for clicking and location.
You can also draw on the map using Polylines and Polygons and you can create shapes which are photos and full 3D google maps setoptions example.
You can also use the AddShape method to add an array of objects and the DeleteShape method removes shapes. Shapes can also be organised into layers. Working with the map control is just a matter of figuring out which methods and properties affect the feature you are trying to control. You can do most of the things that a Google Maps user can, including planning a route and finding locations.
My advice is to read through the methods and properties of the Map object, which is the central object in the system, and investigate any of the methods and properties that interest you. Often this will involve finding out how some auxiliary object works that is used as a parameter in the method.
In most cases extending Google Maps is a matter of adding shapes, objects and other graphics at various locations. Sometimes you might want to add a more advanced facility and in this case it helps to copy the same approach used by Google i.
You can use this method to control even the parts of the DOM that the map object uses and so change the look of things like markers in code or in CSS.