Tag Archive for 'API'

Python Flickr API geo-search example

I just started using the wonderful flickrapi Python interface for, well, searching Flickr for geocoded photos around given locations. It’s fairly easy to use and does most things for you. You start with a Flickr API object…

import flickrapi
api_key = '1234567890'
flickr = flickrapi.FlickrAPI(api_key, cache=True)

…replace some dots with underscores in the Flickr API methods…

photos = flickr.photos_search(tags='boston', lat='42.355056', lon='-71.065503', radius='5')

…and loop through the parsed results…

for photo in photos[0]:
	print photo.attrib['title']
	photoLoc = flickr.photos_geo_getLocation(photo_id=photo.attrib['id'])
	print photoLoc[0][0].attrib['latitude']
	print photoLoc[0][0].attrib['longitude']
	photoSizes = flickr.photos_getSizes(photo_id=photo.attrib['id'])
	print photoSizes[0][1].attrib['source']


The above code example lists title, latitude, longitude and thumbnail-source of photos found in a 5km radius search around the Boston Common.

Yet another mapping API

CloudMade, the professional service around OpenStreetMap, is offering a pre-alpha web and mobile maps API to developers.

The interesting thing about the CloudMade API is easy access to OpenStreetMap data. Compared to commercial map data used in other APIs, like TeleAtlas or NAVTEQ maps, OpenStreetMap shows addtional features like footpaths, bike lanes or tramway tracks in urban areas. Not a crucial feature, right, but here OpenStreetMap is closer to traditional city maps, maps made for pedestrians, than others are. it’s surely an interesting aspect for providing tourism or travel mapping services. Nokia maps go into that direction too and provide special features like pedestrians navigation for instance.

Another point for OpenStreetMap is its appealing cartography. Since it’s possible to export and download OpenStreetMap as vector data, I wonder if the CloudMade API provides methods for manipulating and customizing visual attributes of the map, like colors or stroke widths. That would really make a difference compared to other mapping APIs. Service providers or developers could almost draw their own maps, make their mapping service visually different from others or just highlight map elements they want to emphasize.

View Larger Map

Thanks to the export feature of OpenStreetMap’s web interface, I started using it as background map on my GPS device. A lot of places are still missing, some places aren’t as accurate as in other maps, but it’s pretty easy to cut a map slice out of OpenStreetMap’s web interface and load it onto a GPS device (instructions). [via Nick]

Us & them

BEV shopsWhile others are offering an API or are working on even free access to public geodata, we are releasing a new portal with 5 different shop versions for public tax funded geodata.

Let alone that the world record attempt for using the smallest possible font size in an unlucky Cheetah UI rip-off isn’t quite state of the art in the year 2008. Especially not in times were public agencies are asked (by law!) to fulfill basic WAI requirements.

Public API impact

A year ago or so, we added a Google Map to a website friends of me are running. The website is about reptiles and amphibians. In one part of the site users can enter details into a form, including the location, when they’ve seen an interesting species. In the meantime their database has grown to a comprehensive collection of (crowd sourced) information like species distribution among our country. It’s not only a hobbyist project, the database means quite a valuable input for species research and protection projects too.

Anyways, before we added a Google Map to the form, user provided location information was very poor. Only a rough location description or coordinate information based on the national topographical map were possible to enter. For national coordinates users had to go to another website, look up the place and copy and paste the coordinates from there back into the form. Definitely not what I would call a convenient solution.

Once we added Google Maps where users could simply pinpoint the location on a map, the collected data turned into something like this:

Herpetofauna Funde in Österreich

Green dots … located with Google Maps (92%)
Red dots … located with a service of our National Mapping Agency (8%)

That says something about the benefit of public available mapping APIs. Especially for projects like this, with no commercial but a strong public interest.

Ordnance Survey heads into a good direction by releasing OpenSpace. OpenSpace is a mapping API, based on public geodata and OpenLayers, the Open Source JavaScript library for mapping. OS is probably the most progressive European mapping agency, so there is hope that others will follow (once they have all fulfilled INSPIRE and are done with metadata updates). It took some time until maps showed up at public authorities’ websites, followed by interactive maps and nowadays you even find WMS here and there. The next evolutionary step is probably public geodata made available through APIs.

During the INSPIRE process it became pretty clear that European mapping agencies don’t favor free public geodata. The API concept could help here: it enables flexible usage of data for users while retaining full control over both, functionality and data, for the mapping agency. Seems like a workable compromise to me.

GeoRSS in Google Maps

This is great news for simple location encoding formats: Google announced today native support for GeoRSS in the Google Maps API.

So to view a GeoRSS flavored feed in Google maps just type the URL into the Google Maps search field or add it as query parameter like this.

What’s next? Maybe GeoRSS feeds getting indexed for searches within Google Earth? Just imagine for a moment the amount of content you could access out of Google Earth…

Draw SVG polygons on Google Maps

Apparently Google has become a bit lazy in updating their API reference. Thanks to people like Mike Williams who give Google a hand and document for the rest of us interesting new features found in the Google Maps API.

Similar to GPolyline, the new GPolygon class, which comes with API v2.69, enables drawing of SVG polygons onto your Google Maps. Two additional parameters define polygon fill color and opacity:

GPolygon(points, border-color?, border-weight?, border-opacity?, fill-color?, fill-opacity?)

See a live example of the new polygon class here. [via gis-news]

Welcome the Flickr Geo API!

Just a day after introducing the new geotagging feature, the Flickr team has released the Flickr Geo API.

It’s simple but powerfull: just add parameters like bbox or accuracy to the flickr.photos.search method and filter any search by location. See the Flickr API documentation for a detailed description of this and other new additions.

Btw, Steward Butterfield has a few quite impressing numbers in his last post about the successful launch of the new Flickr feature…

Flickr can read automatically the EXIF location information of your photos, but you have to enable this feature first. Do it here!