public
Last active

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
$.getJSON('http://api.flickr.com/services/rest/?method=flickr.places.getInfo&api_key=get_your_own&woe_id=44418&format=json&jsoncallback=?', function(data) {
if(data.place.has_shapedata == 1) {
var bounds = new GLatLngBounds();
$.each(data.place.shapedata.polylines.polyline, function(index,polyline) {
thepoints = [];
$.each(polyline._content.split(/ /), function(pindex, point) {
lat = parseFloat(point.split(/,/)[0]);
lng = parseFloat(point.split(/,/)[1]);
thepoints[pindex] = new GLatLng(lat, lng);
});
// we use jquery.jmap2.js for a convenience addPolygon method, but it's only a thin wrapper
$("#iconmap").addPolygon({
points:thepoints,
geodesic: true, // needs local patch to jmap2
strokeWeight: 1,
fillopacity: 0.4,
fillColor:'#59ead8'
});
$.each(thepoints, function(pindex, point) {
bounds.extend(point);
});
});
if(!bounds.isEmpty()) {
$.jmap.GMap2.setCenter(bounds.getCenter(),$.jmap.GMap2.getBoundsZoomLevel(bounds));
}
}
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.