好了,在使用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