Commit Graph

313 Commits

Author SHA1 Message Date
amercader d11693f076 [#15] Read search backend config option once only 2013-04-11 17:13:53 +01:00
amercader 970dfd1b68 Merge branch 'release-v2.0' into 15-solr-based-spatial-search 2013-04-11 12:51:08 +01:00
amercader 7da8f4bbd8 [#8] Fix code tags 2013-04-10 19:04:34 +01:00
amercader 5087d2630d [#8] Update spatial harvester docs for 2.0 2013-04-10 19:02:16 +01:00
amercader a2f95f4da4 First docs draft 2013-04-10 17:37:33 +01:00
kindly d1594b3790 do not use kwarg for unicode errors 2013-04-09 12:06:38 +01:00
amercader 65e056d519 Merge branch 'release-v2.0' into 15-solr-based-spatial-search 2013-04-03 12:14:20 +01:00
amercader ff25ff2f2b [#8] Abort import stage if get_package_dict returns nothing 2013-04-02 18:40:03 +01:00
amercader 9760546d13 [#8] Add extra xpath for getting resources
According to the ISO spec gmd:MD_DigitalTransferOptions can be accessed
via a gmd:MD_Distributer tag
2013-03-27 17:39:51 +00:00
amercader 0c98e6ec4c [#8] Minor fix in single doc harvester 2013-03-27 17:38:42 +00:00
amercader 7cae9a1a82 Pin down OWSLib version to ensure it includes geopython/OWSLib@e0a0da02 2013-03-26 17:59:54 +00:00
amercader fede0b0831 [#15] Ensure that bounding boxes are defined counter-clockwise
To return correct results on a spatial query, rectangle geometries must
be defined in counter-clockwise order [1]. This changeset adds a small
sanity check to before_index when we are dealing with a Polygon geometry
that has 5 coordinate pairs. Shapely is used to generate a LinearRing
from the polygon coordinates and check if they are ccw. If not, they are
reordered and a new polygon is generated so the WKT sent to Solr is
properly ordered.

The GeoJSON template used for extents in the base spatial harvester has
been also updated to define the coordinates counter-clockwise.

[1]
http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4#JTS_.2BAC8_WKT_.2BAC8_Polygon_notes
2013-03-23 19:28:31 +00:00
amercader 40967385b0 [#8] Fix typo in WMS format detection 2013-03-21 17:53:38 +00:00
amercader 0e0b5a2cc2 [#8] Fix bug that prevented setting a default resource name 2013-03-21 14:34:42 +00:00
amercader 627c4c58e0 [#8] Fix bug that prevented setting a default resource name 2013-03-21 14:34:23 +00:00
amercader c7a9cc660f [#15] Add suport for Solr spatial indexing and querying
When the 'ckanext.spatial.search_backend' config option is set to
'solr', the extension will index geometries stored in the 'spatial'
extra on the spatial field of the Solr index (named 'spatial_geom').
This is done on the 'before_index' extension point.

Also, when doing a query, if the same config option is in place, the
necessary fq parameter will be set to pass the spatial query to Solr.
2013-03-20 16:54:55 +00:00
amercader a727aa815b Add helper functions useful to format extras coming from the spatial harvesters 2013-03-18 15:59:20 +00:00
amercader a9a634384b [#14] Add pyparsing requirement. Fixes #14 2013-03-14 17:47:57 +00:00
amercader a7fc19768b [#8] Remove print commands from WAF harvester 2013-03-14 17:45:34 +00:00
amercader eb201e1759 [#8] Waf harvester: improve exception and return empty list if no records 2013-03-14 17:35:51 +00:00
amercader 0aafffc8dc [#8] Capture exceptions during request in WAF harvester 2013-03-14 14:56:42 +00:00
amercader d2723c3020 [#8] resource-type not always present 2013-03-14 14:30:16 +00:00
amercader a76a8d2ca7 [#8] Don't use object id so messages can be grouped 2013-03-14 12:37:35 +00:00
amercader 4638b3899f Revert "[#8] Don't use object id so messages can be grouped"
This reverts commit 032cc4d961.
2013-03-14 12:36:39 +00:00
amercader 032cc4d961 [#8] Don't use object id so messages can be grouped 2013-03-14 12:34:20 +00:00
amercader da1dc02c7e [#8] Improve fields returned in the package dict
Make them less uklp specific and more parse friendly. Helper functions
should be used in the UI to format them nicely.
2013-03-08 18:57:30 +00:00
amercader 724ef6ed7c [#8] Fix gemini harvester after change in spatial field 2013-03-08 18:56:03 +00:00
amercader 7822285b26 [#12] Fix wrong geometry type in 'Setting up a spatial table' section of README 2013-03-07 15:19:54 +00:00
amercader f795a33ac5 [#12] Fix wrong geometry type in 'Setting up a spatial table' section of README 2013-03-07 15:19:40 +00:00
amercader e7f70c4f85 [#8] Fix KeyError in point template 2013-03-05 18:38:55 +00:00
amercader 7c5071bfc2 [#8] Sanitize bbox before creating spatial extra
Some common problems:
* Whitespace, tabs, line feeds and plus signs: should be handled by
  float()
* Text: log error and skip creation of spatial extra
* Same set of 2 coords for extent: create point instead of polygon

Note that the bbox values are stored as they are in the bbox-xx-yy
extras
2013-03-05 18:31:49 +00:00
amercader d158a6c684 [#8] Change 'Resource locator' string for unnamed resources
'Resource locator' was confusing, has been replaced by 'Unnamed
resource' and made translatable. Also don't set description if not
present, set name.
2013-03-04 17:55:34 +00:00
amercader d43cbb8800 [#8] Improve resource format detection
The 'guess_resource_format' function looks for common patterns in popular
geospatial services and file extensions. It just looks at the provided URL,
it does not attempt to perform any remote check. By default, it will use the
mimetypes module if no match was found before to try to guess the format.

On the previous version, all resources in documents of type 'service' were
queried to see if they were actually WMS. This is no longer the case,
but services flagged as 'wms' can be verified if the following setting
is set to True: ckanext.spatial.harvest.validate_wms
2013-03-04 17:44:18 +00:00
amercader 23960455ff Merge branch '8-new-spatial-harvesters' into release-v2.0 2013-03-01 17:58:11 +00:00
amercader da5b37bc45 [#8] Fix typo in GeoJSON template 2013-03-01 17:42:51 +00:00
amercader d5461477aa [#8] Do not add XML declaration when storing the content
Rather than store the XML declaration in the DB, we add it if not present
when outputing the contents (Also in ckanext-harvest's show_object)
2013-03-01 17:33:53 +00:00
amercader ee31d76e9d Merge branch 'release-v2.0' into 8-new-spatial-harvesters
Conflicts:
	README.rst
2013-02-28 09:48:59 +00:00
amercader d7d49c37e5 [#8] Check if tags exist on get_package_dict 2013-02-25 16:03:36 +00:00
amercader 5aeaa209ed Fix bug in spatial query sorting 2013-02-20 12:09:50 +00:00
amercader cc60327d0b [#10] Improve harvested metadata API
Some improvements on the endpoints that return the contents of the
harvest objects:

* Nicer URLs with redirects to the old ones
* Returning the raw harvest object content is available on the main
 harvest extension, so just redirect there
* Support for showing the original document of a harvest object, if
 present
* Suport for defining a custom XSLT for the HTML view, via

ckanext.spatial.harvest.xslt_html_content
ckanext.spatial.harvest.xslt_html_content_original
2013-02-19 18:38:15 +00:00
amercader 34d3e372b8 [#10] Improve harvested metadata API
Some improvements on the endpoints that return the contents of the
harvest objects:

* Nicer URLs with redirects to the old ones
* Returning the raw harvest object content is available on the main
 harvest extension, so just redirect there
* Support for showing the original document of a harvest object, if
 present
* Suport for defining a custom XSLT for the HTML view, via

ckanext.spatial.harvest.xslt_html_content
ckanext.spatial.harvest.xslt_html_content_original
2013-02-19 18:31:40 +00:00
amercader 8647f90cb6 [#8] Clean up base harvester, docstrings, some pep8 2013-02-18 18:17:36 +00:00
amercader 6783d58006 [#8] Add support for import command to new harvester
The import CLI reruns the import stage for the last current objects, so
when running it, the previous objects don't need to be changed. Any
date check is overridden to force the update of the package.
2013-02-18 17:19:14 +00:00
amercader 1ffe8fc902 [#8] Use plugins toolkit whenever possible 2013-02-15 15:03:03 +00:00
amercader 32a93b8ec8 [#8] Add get_extra to SpatialHarvester class 2013-02-15 14:56:00 +00:00
amercader 4964ce9ec3 [#8] Provide a config option to continue after validation errors
This can be set instance wide on the ini file with

ckanext.spatial.harvest.continue_on_validation_errors

or per source, adding continue_on_validation_errors=true to the source
config.
2013-02-15 14:47:25 +00:00
amercader 596bdbf5d0 [#8] Minor tweak to source_config 2013-02-15 12:50:09 +00:00
amercader 2ff5a11911 [#8] Use site user for harvesting actions
You don't need to create a 'harvest' sysadmin user any more.
By default this will be the internal site admin user. This is the
recommended setting, but if necessary it can be overridden by
the `ckanext.spatial.harvest.user_name` config option, eg to
support the old hardcoded 'harvest' user
2013-02-15 12:28:58 +00:00
amercader baf7b5da67 [#8] Rename harvested document model to ISODocument
GeminiDocument has been kept for backwards incompatibility.
2013-02-13 19:16:36 +00:00
amercader dadd174293 [#8] Make sure only list and dict extras are dumped as JSON 2013-02-13 18:48:53 +00:00