Moved the call to get_site_user higher on base.py so it's available to
extensions. Also added the parsed XML etree so it does not need to be
parsed from the string again.
Two extension points: ``get_package_dict`` and ``transform_to_iso``,
with the same expected behaviour as the old hooks meant to be overriden.
For ``get_package_dict`` we now pass, apart from the generated
package_dict, the parsed iso_values and the harvest object.
Updated docs and added autodocs.
Otherwise you get this exception when the date on the document has time
zone information, as dates as stored without it on the database:
TypeError: can't compare offset-naive and offset-aware datetimes
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
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
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