- February 8, 2017
- Posted by: user
- Category: Uncategorized
One of our projects had a requirement for displaying a google map on one the webpages.
There are three options for setting google map key for your application.
1) You can use the cfajaximport tag and specify the map API key in the params attribute as follows :
[code:cf]<cfajaximport params="#{googlemapkey=’Your Google Map Key Here’}#"/>[/code]
2) You can set googleMapKey in Application.cfc as follows:
[code:cf]<cfset this.googlemapkey="Your Google Map Key Here">[/code]
3) You can use the Settings page in the ColdFusion Administrator. Specify the map API key in the Google Map Key field.
Now you know that how to get started using maps, you’re ready to see examples. I have set up the API key in the application.cfc file. To get started all you need to know the street address or a longitude and latitude. In the below given example we are using the address for iSummation Technologies Pvt. Ltd. 304, Shapath-3 Bodakdev, Ahmedabad.
The following two lines of code will produce the same result.
[code:cf]
<cfmap centeraddress="iSummation Technologies Pvt. Ltd. 304, Shapath-3 Bodakdev, Ahmedabad"/>
<cfmap centerlatitude="23.04039" centerlongitude="72.51605" />
[/code]
When the user clicks on the marker, Generally you want to display more information about the location.
You can display this information statically by using the markerwindowcontent attribute or dynamically by using the markerbind attribute.
[code:cf]
<cfsavecontent variable="content">
<strong>iSummation Technologies Pvt. Ltd</strong><br/>
304, Shapath-3<br/>
Ahmedabad, Gujarat 380054 <br/>
079 2685 3054<br/><br/>
<a href="https://www.isummation.com">iSummation.com</a>
</cfsavecontent>
<cfmap name="CFMAP"
centeraddress="iSummation Technologies Pvt. Ltd. 304, Shapath-3 Bodakdev, Ahmedabad"
height="500" width="700"
hideborder="false" zoomlevel="12"
collapsible="true"
title="iSummation Technology" markerwindowContent="#content#"/>
[/code]
Please refer below screen shot.
More : Adobe Article