javascript - How do I correctly zoom to bounds in MapQuest? -
javascript - How do I correctly zoom to bounds in MapQuest? -
i'm attempting utilize mqa.tilemap.zoomtorect
set view-port of given bounding box.
var cust; var rect = new mqa.rectll(); (var = 0, len = custs.length; < len; i++) { cust = custs[i]; poi = new mqa.poi({lat:cust.lat, lng:cust.lng}); map.addshape(poi); // works rect.extend(poi.latlng); // nil `rect'. } map.zoomtorect(rect, false); // fails
it appears rect
values remain 0,0
both lr
, ul
properties. phone call results in next output in firebog
"networkerror: 500 internal server error - http://coverage.mqcdn.com/coverage?format=json&jsonp=mqa._covcallback&loc=nan,nan,nan,nan&zoom=2&projection=sm&cat=map%2chyb%2csat"
edit: i've added notes illustration adding shape works fine, poi object fine, inspecting poi.latlng
fine.
if set poi's in collection can utilize collections getboundingrect
method.
example:
var collection = new mqa.shapecollection(); collection.add( new mqa.poi( { lat: 0, lng: 0 } ) ); collection.add( new mqa.poi( { lat: 100, lng: 100 } ) ); map.zoomtorect( collection.getboundingrect() );
javascript openstreetmap mapquest
Comments
Post a Comment