Usage and documentation for source:trunk/py/ws-compose.py

ws-compose.py - a bare bone HTTP interface to the ModestMaps map tile
composer.

------------------------------------------------------------------------
EXAMPLE
------------------------------------------------------------------------

http://127.0.0.1:9999/?provider=GOOGLE_ROAD&latitude=41.904688&longitude
=12.494308&zoom=17&height=500&width=500

Returns a PNG file of a map centered on the Santa Maria della Vittoria,
in Rome.

------------------------------------------------------------------------
PARAMETERS
------------------------------------------------------------------------

* provider (required)

	A valid ModestMaps map tile provider.

* method (required)

	One of the following options :

	* center (optional)

		Render map tiles centered around a specific coordinate. If defined,
		the following parameters must also be present :

		* latitude (required)

			A valid decimal latitude.

		* longitude (required)

			A valid decimal longitude.

		* accuracy (required)

			The zoom level / accuracy (as defined by ModestMaps rather than any
			individual tile provider) of the final image.

		* height (required)

			The height of the final image

		* width (required)

			The width of the final image

	* extent (optional)

		Render map tiles at a suitable zoom level in order to fit a bounding
		box in an image with specific dimensions. If defined, the following
		parameters must also be present :

		* bbox (required)

			A bounding box comprised of comma-separated decimal coordinates in
			the following order : SW latitude, SW longitude, NE latitude, NE
			longitude

		* height (required)

			The height of the final image

		* width (required)

			The width of the final image

	* bbox (optional)

		Render all the map tiles necessary to display a bounding box at a
		specific zoom level. If defined, the following parameters must also be
		present :

		* bbox (required)

			A bounding box comprised of comma-separated decimal coordinates in
			the following order : SW latitude, SW longitude, NE latitude, NE
			longitude

		* accuracy (required)

			The zoom level / accuracy (as defined by ModestMaps rather than any
			individual tile provider) of the final image.

------------------------------------------------------------------------
METADATA
------------------------------------------------------------------------

Metadata about an image is returned in HTTP headers prefixed with
'X-wscompose-'.

For example :

	HTTP/1.x 200 OK
        Server: BaseHTTP/0.3 Python/2.5
        Date: Sun, 13 Jan 2008 01:08:37 GMT
        Content-Type: image/png
        Content-Length: 1946576
        X-wscompose-Image-Height: 1024
        X-wscompose-Image-Width: 1024
        X-wscompose-Map-Zoom: 14.0

------------------------------------------------------------------------
ERRORS
------------------------------------------------------------------------

Errors are returned with the HTTP status code 500. Specific error codes
and messages are returned both in the message body as XML and in the
'X-ErrorCode' and 'X-ErrorMessage' headers.

------------------------------------------------------------------------
QUESTIONS
------------------------------------------------------------------------

Is it fast?

	Not really. It is designed, primarily, to be run on the same machine
	that is calling the interface.

Will it ever be fast?

	Sure. It is on The List (tm) to create a mod_python and/or wsgi
	version. Patches are welcome.

Can I request map images asynchronously?

	Not yet.

Can I get a pony?

	No.

------------------------------------------------------------------------
LICENSE
------------------------------------------------------------------------

Copyright (c) 2007-2008 Aaron Straup Cope. All Rights Reserved. This is
free software. You may redistribute it and/or modify it under the same
terms the BSD license : http://www.modestmaps.com/license.txt