The widget allow to insert a map from google map, reading data from datasource for show overlays like marker, line, polygons.
Google allow using of a javascript API for insert inside a page a dinamic map. To this map is possible to add one or more ovelays, like markers (special icons for highlight a point), lines and polygons.
For using this service is needed a key (for free) that will be passed as parameter to API call, that will be associated to the domain used in page url.
In following examples the key may be used for urls like http://localhost.
All coordinates used for map and overlays must be geographic longitude and latitude, no such simple for umans.
In p4a_map we prefer use conventional address: this is possible, thanks to Ajax function that querying google database return to a callback function geografical lat/lan used to dinimically update map and overlays.
So, before use an address, is better testing on Google Map site form avoid duplication or losing of coordinates.
You view an example of code in the file GoogleTest.php of the downloaded package.
For using p4a_map, are avaiable this methods:
| Method | Parameters | Description |
|---|---|---|
| setCenter | string $address | set addres for the center of map |
| getCenter | read center address of map | |
| setZoom | int $zoom | set initial zoom (from 1 to 17) |
| getZoom | read initial zoom | |
| setKey | string $key | set key to pass at Goggle Map API |
| setWidth | int $width string $unit | wrapper to standard widget method |
| setHeight | int $height string $unit | wrapper to standard widget method |
| string getWidth | wrapper to standard widget method | |
| string getHeight | wrapper to standard widget method | |
| addMarker | string $address string $info | set manually a marker to address and show, moving mouse over, the info gived |
| setSourceAddressField | string $name | set name of source field used for address of marker |
| string getSourceAddressField | read name of source field used for address of marker | |
| setSourceDescriptionField | string $name | set name of source field used for address of marker |
| string getSourceDescriptionField | get name of source field used for address of marker | |
| setSource | data_source $src | set data source used for get markers data |
| data_source getSource | get data source used for get markers data |
Rel 0.1 2007/10/17
Rel 0.1.1 2007/10/22
Rel 0.1.2 2008/04/01
Rel 0.2
Rel 0.3
Rel 0.4
Rel 0.5
For using widget include the files p4a_map.php and p4a_map.js like in this example.