Forums: Customize map marker description - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Customize map marker description

#1 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16112
  • Joined: 03-February 03
  • Gender:Male

Posted 17 June 2016 - 07:23 PM

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.

Posted Image

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.
Best regards,
Sergey Kornilov
0

#2 User is offline   Phouthon Siharat 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 02-October 18

Posted 14 October 2018 - 11:33 AM

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?
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users