【发布时间】:2011-07-07 17:38:13
【问题描述】:
我有一个州边界的纬度和经度值数据库,我用它在地图上绘制州的多边形。
我正在使用 Coldfusion 查询数据库,我希望像这样返回值 例子
“纽约”:[新 google.maps.LatLng(1,2),新 google.maps.LatLng(3,4),新 google.maps.LatLng(5,6)]
对于每个请求的状态,然后将其放入 stateBorders 的 javascript 数组中
见下面的代码:
<cfquery datasource="source" name="states">
select * from state_lat_long where stateid order by stateid, orderid
</cfquery>
var stateBorder={};//declare array to hold the state latitude and longitude values
//need to take this whole thing and put it into array, then loop through the array
<cfoutput query="states" group="stateid">
var #states.stateid# = [
"#states.stateid#":[
<cfset count=0>
<cfoutput> <cfif count>, </cfif>new google.maps.LatLng (#states.latitude#,#states.longitude#)<cfset count=count +1></cfoutput>
]
];
stateBorder.push(states.stateid);
</cfoutput>
感谢您的帮助。
【问题讨论】:
-
您到底要问什么?我没有在任何地方看到任何问题。
标签: javascript arrays google-maps coldfusion