jMaps 介绍
jMaps 是一个 jQuery 的插件,提供了简单的 API 来访问 Google 地图,主要的功能有:
- Geocode and reverse any valid address in the world via Google’s geocoding API
- Search for directions to and from any location
- Add and remove Markers
- Add and remove polygons and polylines
- Add and remove graphic layers on the map
- Add and remove Google adsense layers
- Add and remove Traffic layers
- Get information back such as map center, map size, map type, etc
示例代码:
jQuery(document).ready(function(){ jQuery('#map1').jmap('init', {'mapType':'hybrid','mapCenter':[37.4419, -122.1419]}); jQuery('#address-submit-1').click(function(){ jQuery('#map1').jmap('SearchAddress', { 'query': jQuery('#address').val(), 'returnType': 'getLocations' }, function(result, options) { var valid = Mapifies.SearchCode(result.Status.code); if (valid.success) { jQuery.each(result.Placemark, function(i, point){ jQuery('#map1').jmap('AddMarker',{ 'pointLatLng':[point.Point.coordinates[1], point.Point.coordinates[]], 'pointHTML':point.address }); }); } else { jQuery('#address').val(valid.message); } }); return false; }); });
jMaps 官网
http://code.google.com/p/jmaps/
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。