[ckan-changes] commit/ckanext-spatial: 3 new changesets
Bitbucket
commits-noreply at bitbucket.org
Fri Sep 30 11:18:35 UTC 2011
3 new changesets in ckanext-spatial:
http://bitbucket.org/okfn/ckanext-spatial/changeset/2bb6cfb4d6e6/
changeset: 2bb6cfb4d6e6
branch: feature-1272-store-extents-from-form
user: amercader
date: 2011-09-30 12:33:36
summary: New Dataset Map Widget plugin.
When enabled, if the dataset has an 'spatial' extra, it shows a map on the
details page. It uses OpenLayers and supports all types of geometries.
affected #: 10 files (-1 bytes)
Diff too large to display.
http://bitbucket.org/okfn/ckanext-spatial/changeset/6eee0e9a6789/
changeset: 6eee0e9a6789
branch: feature-1272-store-extents-from-form
user: amercader
date: 2011-09-30 12:57:09
summary: Update and cleanup for WMS previewer. It is still very unstable and should be
considered alpha stage.
affected #: 7 files (-1 bytes)
Diff too large to display.
http://bitbucket.org/okfn/ckanext-spatial/changeset/d5bee3de9957/
changeset: d5bee3de9957
branch: feature-1272-store-extents-from-form
user: amercader
date: 2011-09-30 13:15:53
summary: [wms_preview] Fix for #1166 (Less stringent filters for WMS preview)
If one of the dataset resources has a 'WMS' format, the link will be
displayed. Also support for URLs with query params.
affected #: 4 files (-1 bytes)
--- a/README.rst Fri Sep 30 11:57:09 2011 +0100
+++ b/README.rst Fri Sep 30 12:15:53 2011 +0100
@@ -108,9 +108,8 @@
- EPSG:4326
- 4326
-
Geo-Indexing your packages
-==========================
+--------------------------
In order to make a package queryable by location, an special extra must
be defined, with its key named 'spatial'. The value must be a valid GeoJSON_
@@ -131,11 +130,25 @@
Dataset Map Widget
==================
-To enable the dataset_map you need to add the `dataset_map` plugin to your
+To enable the dataset map you need to add the `dataset_map` plugin to your
ini file (See 'Configuration'). You need to load the `spatial_query` plugin also.
When the plugin is enabled, if datasets contain a 'spatial' extra like the one
-described in the previous section, a map will be shown in the dataset details page.
+described in the previous section, a map will be shown on the dataset details page.
+
+
+WMS Previewer
+=============
+
+To enable the WMS previewer you need to add the `wms_preview` plugin to your
+ini file (See 'Configuration').
+
+Please note that this is an experimental plugin and may be unstable.
+
+When the plugin is enabled, if datasets contain a resource that has 'WMS' format,
+a 'View available WMS layers' link will be displayed on the dataset details page.
+It forwards to a simple map viewer that will attempt to load the remote service
+layers, based on the GetCapabilities response.
--- a/ckanext/spatial/controllers/view.py Fri Sep 30 11:57:09 2011 +0100
+++ b/ckanext/spatial/controllers/view.py Fri Sep 30 12:15:53 2011 +0100
@@ -26,10 +26,10 @@
for res in c.pkg.resources:
if res.format == "WMS":
- c.wms = res
+ c.wms_url = res.url if not '?' in res.url else res.url.split('?')[0]
break
- if not c.wms:
- abort(400, 'This package does not have a WMS')
+ if not c.wms_url:
+ abort(400, 'This package does not have a WMS resource')
return render('ckanext/spatial/wms_preview.html')
--- a/ckanext/spatial/plugin.py Fri Sep 30 11:57:09 2011 +0100
+++ b/ckanext/spatial/plugin.py Fri Sep 30 12:15:53 2011 +0100
@@ -132,13 +132,14 @@
if routes.get('controller') == 'package' and \
routes.get('action') == 'read' and c.pkg.id:
- is_inspire = (c.pkg.extras.get('INSPIRE') == 'True')
- # TODO: What about WFS, WCS...
- is_wms = (c.pkg.extras.get('resource-type') == 'service')
- if is_inspire and is_wms:
- data = {'name': c.pkg.name}
- stream = stream | Transformer('body//div[@class="resources subsection"]')\
- .append(HTML(html.MAP_VIEW % data))
+ for res in c.pkg.resources:
+ if res.format == "WMS":
+ data = {'name': c.pkg.name}
+ stream = stream | Transformer('body//div[@class="resources subsection"]')\
+ .append(HTML(html.MAP_VIEW % data))
+
+ break
+
return stream
--- a/ckanext/spatial/templates/ckanext/spatial/wms_preview.html Fri Sep 30 11:57:09 2011 +0100
+++ b/ckanext/spatial/templates/ckanext/spatial/wms_preview.html Fri Sep 30 12:15:53 2011 +0100
@@ -15,7 +15,7 @@
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
- CKAN.WMSPreview.setup("${c.wms.url}");
+ CKAN.WMSPreview.setup("${c.wms_url}");
})
//]]></script>
@@ -29,9 +29,9 @@
</h2><!-- Source URL -->
- <div class="url" py:if="c.pkg.url">
+ <div class="url" py:if="c.wms_url"><p>
- Source: <a href="${c.wms.url}" target="_blank">${c.wms.url}</a>
+ Source: <a href="${c.wms_url}" target="_blank">${c.wms_url}</a></p></div><p>
Repository URL: https://bitbucket.org/okfn/ckanext-spatial/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the ckan-changes
mailing list