GEO-位置与手机和谷歌地图api

时间:2014-02-28 08:52:38

标签: google-maps-api-3 cordova geolocation laravel-4

我一直在尝试创建一个移动应用程序,它将搜索我自己的MySQL database,其中存储了有关企业的信息(lat,lng,商业名称)。

以下是我希望如何使用它的分步指南。

1). The user will manually input a postcode
2). PHP (laravel) will process the request
3). The Google Maps API will use the Lat, 
Lngs I have stored in my database and display the location closest to the postcode which has been entered.
4). Display the results on the page

我正在使用PhoneGap来创建移动应用程序,而对于我正在使用Laravel的PHP框架。

1 个答案:

答案 0 :(得分:0)

我的方法是将邮政编码和lat,lng缓存到表格中。所以你的请求会更快。

您需要做的是从用户那里获取邮政编码并将其发送到google api以获得lat长。然后使用这些值来搜索数据库。

谷歌的这个教程可能有助于确定最接近数据库的企业。 https://developers.google.com/maps/articles/phpsqlajax_v3