开发者

Integrate a 'My Maps' from Google Map's into a site and make the places searchable

I was wondering how to inte开发者_JS百科grate one of 'My maps' into a site. I know there's an embed option but the idea was not only using all the places I added there but also make them searchable (by using a search box I guess).

Thanks in advance


Update: Found this but I want to make it work with 'My maps'. Ideas?


I would suggest using the Google Maps API. It offers much more flexibility than MyMaps.

Google Maps API Family: http://code.google.com/apis/maps/index.html

In particular, you might be interested in: http://code.google.com/apis/maps/documentation/javascript/

Using it requires a bit of knowledge of JavaScript, but it isn't too hard.

Developer's guide: http://code.google.com/apis/maps/documentation/javascript/basics.html Tutorial: http://code.google.com/apis/maps/documentation/javascript/tutorial.html

Hope this helps.


You have to do bit of server side scripting to make them searchable

First thing, is you need to define your centre of the map. Then add markers/location to the map and store their lat/lng values server side. When someone enters postcode/zip you need to use Geocode Google Maps API service to get lat/lng of the value entered, use it as a center, and then calculate distance using haversine formula to show nearest locations.

Geocode API link

Haversine formula link

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜