ColdFusion9支持Google MAP

   ColdFusion9开始,可以支持Google MAP。这个在Flex/Flash中早已经支持这一特征,现在轮到CF9,其实CF9是使用Google Map API for Javascript处理的。

  例子文件:

  welcome.cfm

 

<cfajaximport params="#{googlemapkey='注册一个google map key'}#">
<cfmap
centerlatitude="28.0670"
centerlongitude="117.1370"
zoomlevel="14"
name="map1"
type="map"
tip="不要指俺家"
zoomControl="small3D"
markerbind="cfc:c008.getMapData({cfmapname}, {cfmaplatitude}, {cfmaplongitude}, {cfmapaddress})"
showmarkerwindow = true
showallmarkers=false>
<cfmapitem name="m2" latitude="40.46" longitude="117.05" showmarkerwindow=true tip="八达岭长城, 北京">
</cfmap>

 

  c008.cfc 处理标记显示

 

 <cfcomponent>
<cffunction name="getMapData" access="remote">
<cfargument name="cfmapname">
<cfargument name="cfmaplatitude">
<cfargument name="cfmaplongitude">
<cfargument name="cfmapaddress">
<cfsavecontent variable="markup">
<br>
<cfoutput>
<table>
<tr>
<td bgcolor='red'><h4><font color='white'>俺的测试例子</font></td>
</tr>
</table>
Map Name: #cfmapname#<br>
Latitude, Longitude: (#DecimalFormat(cfmaplatitude)#,#DecimalFormat(cfmaplongitude)#)<br>
Address: #cfmapaddress#<br>
</cfoutput>
</cfsavecontent>
<cfreturn markup>
</cffunction>
</cfcomponent>

 

 

主要语句说明:

<cfajaximport params="#{googlemapkey='注册一个google map key'}#">

 指定一个google map key'

 

cfmap属性

centerlatitude:地图中心经度

centerlongitude:地图中心纬度

markerbind:标记数据处理组件

 

cfmapitem标签指示指定义的地图标签

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值