Friday, February 28, 2014

OpenStreetMap TileStitcher

Another small Python geo utility library is ready. It is called OpenStreetMap TileStitcher.

The problem it solves is the following: You have an area on the Earth, and you want to have a continuous image of it. You can retrieve tiles (tiles are square images shown in various mapping webapps, like google maps, bing maps, or OSM), but you need to merge them and crop to your desired area.

OSM TileStitcher will do that for you.

Example:
slipy_map = mod_tilestitcher.SlippyMapTiles()
image = slipy_map.get_image((45.2775, 46.3785), (13.5261, 14.9271), 200, 200)
image.show()
More information in the README.

Friday, February 14, 2014

Echo http requests

At my previous workplace I had a problem when testing some API calls. The workflow is as follows:
  • The user registers his url (callback)
  • When an event happens we call his callback url
Now, this is all simple, but when testing it I need a publicly available (callback) url. But I have a private IP address and I'm behind a firewall. Now, having a new web server just to test if we received some https requests is complicated.

That's how Echo http requests is born. It is a very simple appengine application (in Python, source here). You just create a random string give somebody an url like http://echo-http-requests.appspot.com/push/YOUR_RANDOM_STRING_HERE

Later, you can retrieve all the requests received on that url with http://echo-http-requests.appspot.com/pull/YOUR_RANDOM_STRING_HERE .

The result is a simple JSON structure with all the headers, http method and body. 

In addition, you can use http://echo-http-requests.appspot.com/echo to get information about your own request.

BTW, Echo-http-requests is free, but... It runs on a free appengine quota. If your usage is too heavy, please download the code and run your own instance.