简体   繁体   中英

Google Maps - MySql - Get some Markers in the radius with a special lat and lng Coordinate

是否可以仅从数据库中获取一个特殊半径内坐标的纬度和经度?

You need to get google.maps.circle.getBounds() and google.maps.circle.fitBounds() to do this. These functions returns LatLngBounds.

var radius = new google.maps.Circle({
    center : myLatlng,
    radius : 500,
    fillOpacity : 0,
    strokeOpacity : 0,
    map : map
});

and then check for the latLng from your Database. For example:

radius.getBounds().contains( yourmarker.getPosition() ) ;

Refer the following link. It will be helpful..

http://www.paulmcilwaine.com/api/google-maps-detecting-markers-in-a-particular-boundary

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM