Google Maps
The Google Maps plugin allows a map window to be quickly added into a custom CWIS interface, drawing the information displayed on the map from Point metadata fields in resource records.
Use
The Google Maps plugin provides a variety of different methods to display geodata.
In the simplest of these methods, a metadata field is selected in the plugin configuration and a CWIS event is signaled from an interface file to generate a map. Points are displayed on the map to represent the data contained in the selected field. Fields can either be a Point which contains latitude/longitude data or a Text field which contains a street address. Then, the following code needs to be inserted in your custom interface to signal the CWIS event:
<style type="text/css">
.GoogleMap {
height: 500px;
min-width: 1px;
}
</style>
<?PHP
$GLOBALS["AF"]->SignalEvent(
"GoogleMaps_EVENT_HTML_TAGS_SIMPLE",
array("DefaultLat"=>45,
"DefaultLon"=>-90,
"DefaultZoom"=>5,
"InfoDisplayEvent"=>"mouseover") );
?>
An SQL query can also be specified in the plugin preferences as a source of geodata. In this case, any subset of resources can be selected, or points displayed on a map can be synthesized and need not correspond directly with particular resources.
More complex methods allow for a great deal of customization in terms of what data is displayed and how. Internally, the plugin uses a PointProvider
function to generate a list of points, and a DetailProvider
to generate the contents of the info bubbles above individual markers. In the above example, the built-in providers were both used. However, they can also be overrideen with your own custom functions. A custom PointProvider
can modify the colors and styles of map markers, and a custom DetailProvider
can display arbitrary HTML in the info bubbles.
See the comments in plugins/GoogleMaps/GoogleMaps.php
in your CWIS site for complete documentation.
Caveats
Google's servers must be able to fetch a file from your site in order for points to be properly displayed