I have a database of latitude and longitude values for state borders which I am using to draw polygons of the state on a map.
I am querying the database using coldfusion and I want the value to be returned like this example
"NY" :[new google.maps.LatLng(1,2), new google.maps.LatLng(3,4), new google.maps.LatLng(5,6)]
for every state that is requested and then put it in a javascript array of stateBorders
see code below:
<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>
Thank you for your help.