Python: module TileStache.Goodies.Providers.SolrGeoJSON

TileStache.Goodies.Providers.SolrGeoJSON | index

`Provider that returns GeoJSON data responses from Solr spatial queries.
This is an example of a provider that does not return an image, but rather
queries a Solr instance for raw data and replies with a string of GeoJSON.
Read more about the GeoJSON spec at: http://geojson.org/geojson-spec.html
Caveats:
Example TileStache provider configuration:
"solr": {
"provider": {"class": "TileStache.Goodies.Providers.SolrGeoJSON.Provider",
"kwargs": {
"solr_endpoint": "http://localhost:8983/solr/example",
"solr_query": "*:*",
}}
}
The following optional parameters are also supported:
latitude_field: The name of the latitude field associated with your query parser;
the default is 'latitude'
longitude_field: The name of the longitude field associated with your query
parser, default is 'longitude
response_fields: A comma-separated list of fields with which to filter the Solr
response; the default is '' (or: include all fields)
id_field: The name name of your Solr instance's unique ID field; the default is ''.
By default queries are scoped to the bounding box of a given tile. Radial queries
are also supported if you supply a 'radius' kwarg to your provider and have installed
the JTeam spatial plugin: http://www.jteam.nl/news/spatialsolr.html.
For example:
"solr": {
"provider": {"class": "TileStache.Goodies.Providers.SolrGeoJSON.Provider",
"kwargs": {
"solr_endpoint": "http://localhost:8983/solr/example",
"solr_query": 'foo:bar',
"radius": "1",
}}
}
Radial queries are begin at the center of the tile being rendered and distances are
measured in kilometers.
The following optional parameters are also supported for radial queries:
query_parser: The name of the Solr query parser associated with your spatial
plugin; the default is 'spatial'.`

Classes
`` |  | Provider SaveableResponse
class Provider
`` |  | Methods defined here: __init__(self, layer, solr_endpoint, solr_query, **kwargs) getTypeByExtension(self, extension) `Get mime-type and format by file extension. This only accepts "json".` renderTile(self, width, height, srs, coord) `Render a single tile, return a SaveableResponse instance.` unproject(self, x, y)
class SaveableResponse
`` | `Wrapper class for JSON response that makes it behave like a PIL.Image object. TileStache.getTile() expects to be able to save one of these to a buffer.`
| Methods defined here: __init__(self, content) save(self, out, format)

Functions
`` |  | atan(...) `atan(x) Return the arc tangent (measured in radians) of x.` log(...) `log(x[, base]) Return the logarithm of x to the given base. If the base not specified, returns the natural logarithm (base e) of x.` pow(...) `pow(x, y) Return x**y (x to the power of y).` tan(...) `tan(x) Return the tangent of x (measured in radians).`

Data
`` |  | e = 2.718281828459045 pi = 3.141592653589793