This topic is locked

Customize map marker description

6/17/2016 3:23:24 PM
ASPRunner.NET Tips and tricks
admin

Q: How to place description on each map marker
A:


  1. Modify SQL Query to create a calculated field with custom name and address.

SELECT

CustomerID,

CompanyName,

ContactName,

ContactTitle,

Address,

Lat,

Lng,

concat(ContactName, '\n', Address) as DisplayOnMap

FROM customers


Notice '\n', it allows us to create multiline descriptions. concat() function is MySQL specific. Similar functions exist in all databases.


2. Insert a map into List page. Here are settings I have used for this specific table.



// Longitude and latitude or address field should be specified

// name of field in table that used as address for map

mapSettings["addressField"] = "DisplayOnMap";

// name of field in table that used as latitude for map

mapSettings["latField"] = "Lat";

// name of field in table that used as longitude for map

mapSettings["lngField"] = "Lng";


Latitude and Longitude fields are required as we use address field for marker description purposes.

S
siharat 10/14/2018

The instructions above works perfectly, however, how do I set the addressField to be open by default? I found a solution on google using:

google.maps.event.addListenerOnce(map, 'tilesloaded', function() {

infowindow.open(map, marker);

});


But when I added it in the Events -> "JavaScript OnLoad event" it did not work. Any suggestions?