papyrus 0.7
papyrus is a geospatial extensions for the Pyramid web framework.
Installation:
Papyrus can be installed with easy_install:
easy_install papyrus
Installing Papyrus in an isolated virtualenv is recommended.
GeoJSON Renderer
Papyrus provides a GeoJSON renderer.
To be able to use the GeoJSON renderer for views its factory must be added to the application configuration.
For that you can either pass the factory to the Configurator constructor:
from pyramid.mako_templating import renderer_factory as mako_renderer_factory
from papyrus.renderers import geojson_renderer_factory
config = Configurator(
renderers=(('.mako', mako_renderer_factory),
('geojson', geojson_renderer_factory))
)
Or you can use the add_renderer method:
from papyrus.renderers import geojson_renderer_factory
config.add_renderer('geojson', geojson_renderer_factory)
Make sure that add_renderer is called before any add_view call that uses geojson as the renderer name.
With the GeoJSON renderer factory registered into the application you can now use it for views. Here's a (fake) example:
@view_config(renderer='geojson')
def hello_world(request):
return {
'type': 'Feature',
'id': 1,
'geometry': {'type': 'Point', 'coordinates': [53, -4]},
'properties': {'title': 'Dict 1'},
}
Requirements:
Ссылка: http://pypi.pyt..s/source/p/papyrus/papyrus-0.7.tar.gz#md5=dbd1dc465342f5ac4197fa46d00f81f1
Новые:
|
Рейтинг за сегодня::
|
Похожие:
|