Google Map Show Results  (by Felice Di Stefano)
(ASP, PHP)

This server behavior is intended for results pages where applicable and will reflects, on the map, the results of contents in a database, including coordinates. Assuming for example we want to filter a recordset based on registered car dealers the result will show on the map the location of each dealer with relative info.
To get benefit of this behavior it is required that the user table (or someway your database) must include columns to save latitude and longitude relative to an address, optionally also two fields for map type and zoom level in case you give the user the option to safe the preferred configuration, it would be appropriate to define coordinates columns as float (10,6) and configuration columns as tinyint(2), they will work anyway if you define as string. In order to show the result on the map, coordinates must be already registered, for this purpose the behavior Google Map Insert Coordinates and the object Google Map Drag and Save Location are included to catch user's coordinates at registration.

Applying

The dialog is divided in two sections, one to control the map and one to define dynamics. First create your result page as normal with a recordset which will return also the saved coordinates then you may apply this behavior which will rely on the results recordset.

Map Control
Google Key: Insert the Google Api key, which you can get it here, for the site address you will use the map. The default key in the dialog can be used only on your machine localhost server.
Map Size: Define here the size of your map in width and height.
Pan/Zoom Control: Add or not the required Pan/Zoom control to the map based on the map size.
Map Type Control: Add or remove the buttons that determine the map type (Normal, Satellite, Hybrid) from the display.
Scale Control: Add or remove the scale display of the current map zoom.
Overview Control: Add or remove the collapsible overview control in the bottom-right of the map.
Remove Type: Checking any of these boxes you may remove a specific map type from the row of buttons.
Add: Checking any of these boxes you may add extra functionalities as Ground map type, Directions and Streetview where available. Note that directions are dependent on correct addresses.
Default Zoom: Select the starting zoom of the map.
Save Conf: Checking this box you allow the Save Configuration feature which applies a link with event on the page to give to the user the option to save the prefered zoom and map type. Note that in this situation saving the zoom may have no effect because the map will always zoom back depending on the number of locations displaied on the map so that all markers will stay inside the map.
Cookie Name: If the Save Conf box is checked a name for the cookie to save is required. This permits to have different configurations on different pages.
Icon Img: You may customize the markers icon by assigning here the url of the desired image. The default address on the dialog represents the default Google marker, you can use also relative pats in case of your own icon. When you want to create your own image take as base the default marker which is included in the package, it is recommended at the moment to use always the same size of picture and the default marker edge. Read more about markers at the bottom of the page.
Icon Shadow Img: As for the marker image you may customize the marker shadow starting from the default picture included in the package. If your customization is relative only to the color of the default marker without altering the shape I will suggest you to leave the default url on the dialog. Also for this when creating a different shadow relative to a new icon use the same picture size and the default shadow edge.
Default map coordinates
You must insert coordinates for the default map, consider that results sometimes may return a no match. To get coordinates is included the Google Map Get Coordinates object which creates a form to retrieve location coordinates.
Once you have retrieved the coordinates insert these in the Latitude and Longitude fields.
Dynamics
Recordset: Choose from this list the recordset which will return the filtered results.
Columns:

There are a number of columns which can be used to get the coordinates and to display info when clicking a marker. Only few of these are required, the Name 1, Latitude and Longitude, all others are optional.
Assign the appropriate column to the label, for instance to the Address label assign the column reporting the address and so on.
For Name 1 assign anything that may represents a name, Name 2 in case the name is made by 2 columns like for first and last name.
The popup info window will contain details in the following order:

Name
Address
Town (and State/Provence if available)
Country

Image (avoid too large pictures)
Description
Url link

A class field is included for an optional style of the Web Address.

The User Map Type and User Zoom Level are optional, you may use these only if you have appropriate columns in the table.

Note: This behavior can be used the same way for a detail page.
The first two rows in the fx_gmresults.js include file are manually editable to adjust the pop-up style as you like and the image path if needed.
Please always check that the onLoad and onUnLoad events are inserted correctly in the <body> tag.
You may change messages displayed in the info window, these are in the included javascript files.

About customized markers

In the package are included a set of customized markers with numbers, in case you want lead each row of the results with a number you may associate numbered markers on the map to each row. The set is made by images named "m#.png" where # is a number, when you want to use these for the above purpose, assuming the folder is "markers" insert the url in this form: markers/m##.png , the application will automatically replace the ## with the appropriate number.


by FELIXONE