2.5 KiB
Previews for Spatial Formats
The extension includes some plugins that implement the IResourcePreview interface, allowing to preview spatial resource files. They are based in popular Javascript mapping libraries and should be really easy to extend and adapt to your own needs.
GeoJSON Preview
The GeoJSON previewer is based on Leaflet. It will render GeoJSON files on a map and add a popup
showing the features properties, for those resources that have a format
of geojson
or gjosn
.
To enable the GeoJSON previewer you need to add the
geojson_preview
plugin to your ini file. This plugin also
requires the resource_proxy
plugin (Make sure you load the resource_proxy
plugin before
any other from the spatial extension):
ckan.plugins = resource_proxy geojson_preview
WMS Preview
The WMS previewer is based o OpenLayers. When the plugin is enabled,
if datasets contain a resource that has wms
format, the
resource page will load a simple map viewer that will attempt to load
the remote service layers, based on the GetCapabilities response.
To enable the WMS previewer you need to add the
wms_preview
plugin to your ini file. This plugin also
requires the resource_proxy
plugin (Make sure you load the resource_proxy
plugin before
any other from the spatial extension:
ckan.plugins = resource_proxy wms_preview
Note
Please note that the WMS previewer included in ckanext-spatial is just a proof of concept and has important limitations, and is just intended as a bootstrap for developers willing to build a more sophisticated one.
Some projects that have built more advanced map viewers and integrated them with CKAN include: