Skip to content

@mattb /gist:25502
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
$.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));
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.