好了,在使用Peter的建议和Google Geocoder v3之后,我把自己的东西扔在一起,因为Google Geocoder v3 cfc不起作用。
<!---Geocode the address and convert it to Lat/Lng --->
<cfset address2geocode = '#Form.Client_Address#, #Form.Client_City#, #Form.Client_State#'>
<cfhttp url="http://maps.google.com/maps/api/geocode/xml?address=#address2geocode#&sensor=true" />
<cfset geocodedXML = #xmlParse(cfhttp.filecontent)#>
<!--- Add the record to the database--->
<cfquery datasource="#dsn#" name="AddMember">
INSERT INTO BSC_Clients (Client_Lng, Client_Lat)
VALUES ('#geocodedXML.GeocodeResponse.result.geometry.location.lng.XmlText#', '#geocodedXML.GeocodeResponse.result.geometry.location.lat.XmlText#')
</cfquery>
这将有效地采取指定的地址+城市+国家(扔在数据库中的所有其他用户信息,这是不是在代码中显示)和将其转换成将被储存回纬度/长值数据库。谷歌地图,然后应通过一个标记显示新地址
基本前提听起来不错。你究竟在哪里确定? – 2010-08-25 14:53:38
如何从Google的地理编码获取坐标并将其存储到数据库中 – knawlejj 2010-08-25 15:02:35