Created
November 16, 2008 15:58
-
-
Save mattb/25502 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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