Commit Graph

88 Commits

Author SHA1 Message Date
Adrian Holovaty ffd7b177c9 Added experimental support for a POSTGIS_VERSION setting for GeoDjango. If set, it will tell GeoDjango not to do the postgis_lib_version() query every time the server starts up (assuming a PostGIS backend). This is intentionally undocumented because Justin mentioned he might be refactoring the backends for Django 1.2 such that this setting would be unnecessary. Until then, people can use this hook.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10549 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-12 07:19:56 +00:00
Justin Bronn d7870d3444 Upgraded SpatiaLite default initialization SQL file name for 2.3 release.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10527 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-11 22:31:28 +00:00
Justin Bronn f146132831 No longer create tables for unnecessary applications when running the GeoDjango test suite.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10498 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 19:19:19 +00:00
Justin Bronn 5e58810e21 Applied latest changes to `ListMixin` from Aryeh Leib Taurog and added him to AUTHORS; fixed memory leak introduced in r10174 -- no longer call `ListMixin.__init__` and set methods manually because it created references that prevented garbage collection; fixed several routines that had no need to be class methods.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10494 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 18:32:17 +00:00
Justin Bronn ae7cb577dd Refactored `get_srid_info` to use the ORM (now possible since it's no longer used in `GeometryField.__init__`), and moved to `fields` module; removed unnecessary code.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10493 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 18:08:37 +00:00
Adrian Holovaty fd443959df Added an SRID_CACHE to GeoDjango db/models/fields/__init__.py so that we only hit the spatial_ref_sys table once per SRID per process
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10488 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 17:04:35 +00:00
Adrian Holovaty bb75efc050 Fixed typo in GeoDjango deprecation error message
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10487 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 16:58:47 +00:00
Adrian Holovaty 800b6cfbbe Changed GeoDjango GeometryField to lazily load units, units_name and _spheroid
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10486 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-10 16:58:29 +00:00
Justin Bronn 1dc72fe876 Now take advantage of new argument accepted by `AddGeometryColumn` in SpatiaLite 2.3 that allows geometry columns to specified as `NOT NULL`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10443 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-08 00:09:06 +00:00
Justin Bronn a6356cad4d Fixed #10757 -- Fixed improper selection of primary keys across relations when using `GeoManager.values`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10434 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-07 21:18:41 +00:00
Justin Bronn 2ec48a1dd9 Now support SVG output in SpatiaLite; added tests for SVG output.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10428 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-07 20:12:08 +00:00
Malcolm Tredinnick dded5f52cc Fixed #10695 -- Fixed implementation of deferred attribute retrieval.
The original implementation had a few silly bugs in it that meant that data was
not being used only on the instance of the class that it was appropriate for
(one of the traps when using class-level things). No more!

Thanks to Justin Bronn and Alex Gaynor for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10382 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-04 03:21:31 +00:00
Malcolm Tredinnick 19d1450929 Tweaked a GIS expected test failure.
The test was only checking for geos version 3.0.0, but it failed for all
3.0.x versions. This change makes the version check skip the test for
anything 3.0-ish.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10381 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-04 03:20:39 +00:00
Justin Bronn 8d42902f19 Fixed #9745 -- Added the `GeoQuerySet` methods `snap_to_grid` and `geojson`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10369 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-02 16:50:44 +00:00
Justin Bronn c398566aa2 Forgot to include the SpatiaLite test SQL files.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10327 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 16:06:22 +00:00
Justin Bronn 03de1fe5f4 Fixed #9871 -- Geometry objects are now returned in dictionaries and tuples returned by `values()` and `values_list()`, respectively; updated `GeoQuery` methods to be compatible with `defer()` and `only`; removed defunct `GeomSQL` class; and removed redundant logic from `Query.get_default_columns`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10326 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-04-01 16:01:50 +00:00
Justin Bronn 449a83ba2e Forgot to remove import of defunct `GeoMixin`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10275 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 17:19:03 +00:00
Justin Bronn 3a0950739b Fixed #9437 -- Now close database connection within `get_srid_info`. Thanks, mattxbart.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10254 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-31 15:49:25 +00:00
Justin Bronn a1e7723c79 Fixed the `add_postgis_srs` routine to support SpatiaLite.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10229 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 22:54:24 +00:00
Justin Bronn 8eca2df3a4 Fixed #9686 -- SpatiaLite is now a supported spatial database backend. Thanks to Matthew Hancher for initial patch and hard work in implementing this feature.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10222 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 22:15:41 +00:00
Gary Wilson Jr 5ff1703f41 Fixed #9130 -- Fixed typo in comment, thanks scel.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 22:10:36 +00:00
Justin Bronn 867e71501c Refactored and cleaned up parts of the spatial database backend. Changes include:
* Laid foundations for SpatiaLite support in `GeoQuerySet`, `GeoWhereNode` and the tests.
* Added the `Collect` aggregate for PostGIS (still needs tests).
* Oracle now goes to 11.
* The backend-specific `SpatialRefSys` and `GeometryColumns` models are now attributes of `SpatialBackend`.
* Renamed `GeometryField` attributes to be public that were private (e.g., `_srid` -> `srid` and `_geom` -> `geom_type`).
* Renamed `create_test_db` to `create_test_spatial_db`.
* Removed the legacy classes `GeoMixin` and `GeoQ`.
* Removed evil `\` from spatial backend fields.
* Moved shapefile data from `tests/layermap` to `tests/data`.

Fixed #9794.  Refs #9686.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@10197 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-30 17:15:49 +00:00
Justin Bronn f0b7cc4a23 Cleanup, bug fixes, and new tests for the GEOS I/O objects and `GEOSBase` object.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10177 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-28 16:36:48 +00:00
Justin Bronn 0b9a855bed Fixed #10620 -- removed carriage returns in a GEOS tests module; fixed other errata such as unnecessary `pymutable_geometries` module and not having `GEOSGeometry` call `__init__`.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10174 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-26 02:07:11 +00:00
Justin Bronn 91ebe9acae Fixed error when trying to import the GEOS tests from their new location.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10137 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-24 04:26:56 +00:00
Justin Bronn 66e1670efa Refactored the GEOS interface. Improvements include:
* Geometries now allow list-like manipulation, e.g., can add, insert, delete vertexes (or other geometries in collections) like Python lists.  Thanks, Aryeh Leib Taurog.
* Added support for GEOS prepared geometries via `prepared` property.  Prepared geometries significantly speed up certain operations.
* Added support for GEOS cascaded union as `MultiPolygon.cascaded_union` property.
* Added support for GEOS line merge as `merged` property on `LineString`, and `MultiLineString` geometries.  Thanks, Paul Smith.
* No longer use the deprecated C API for serialization to/from WKB and WKT.  Now use the GEOS I/O classes, which are now exposed as `WKTReader`, `WKTWriter`, `WKBReader`, and `WKBWriter` (which supports 3D and SRID inclusion)
* Moved each type of geometry to their own module, eliminating the cluttered `geometries.py`.
* Internally, all C API methods are explicitly called from a module rather than a star import.

Fixed #9557, #9877, #10222


git-svn-id: http://code.djangoproject.com/svn/django/trunk@10131 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-24 00:12:21 +00:00
Justin Bronn 44b0f68f44 GeoDjango test suite now takes advantage of `importlib` added in r10088.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10103 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-20 02:50:48 +00:00
Justin Bronn 9eb061b2c0 Fixed #10480 -- made `icons` a property to add more flexibility.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10102 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-20 02:10:47 +00:00
Malcolm Tredinnick 0543f33bbc Fixed the django.contrib.gis test database creation as well.
Refs r10026 and r10027.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10028 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-11 05:48:26 +00:00
Justin Bronn 6aa5aacc86 Fixed #9204 -- Added `GIcon` overlay, allowing customization for icons of `GMarker` objects. Thanks to qingfeng for initial ticket/patch, and to prairiedogg for final implementation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10021 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-10 18:03:35 +00:00
Justin Bronn d45e24a1f8 Fixed #9955 -- Added `GoogleMapSet`, which enables multiple `GoogleMap` objects to placed on the same page; moved all templates to `google` parent dir, and added 'google-map.html' for an included example. Thanks to mandric for the ticket and aromano for initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10011 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-09 19:22:24 +00:00
Malcolm Tredinnick 35f934f5a7 Pass values through get_db_prep_save() in a QuerySet.update() call.
This removes a long-standing FIXME in the update() handling and allows for
greater flexibility in the values passed in. In particular, it brings updates
into line with saves for django.contrib.gis fields, so fixed #10411.

Thanks to Justin Bronn and Russell Keith-Magee for help with this patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10003 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-09 00:03:03 +00:00
Justin Bronn cee31735f7 Fixed #10072 -- `GMarker` overlays now have `draggable` option. Thanks to prairiedogg for ticket and patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10002 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-08 18:34:24 +00:00
Justin Bronn f1ada99997 Maintenance refactor of the GDAL (OGR) ctypes interface. Changes include:
* All C API method explictly called from their prototype module, no longer imported via *.
* Applied DRY to C pointer management, classes that do so subclass from `GDALBase`.
* `OGRGeometry`: Added `from_bbox` class method (patch from Christopher Schmidt) and `kml` property.
* `SpatialReference`: Now initialize with `SetFromUserInput` (initialization is now more simple and flexible); removed duplicate methods.
* `Envelope`: Added `expand_to_include` method and now allow same coordinates for lower left and upper right points.  Thanks to Paul Smith for tickets and patches.
* `OGRGeomType`: Now treat OGC 'Geometry' type as 'Unknown'.

Fixed #9855, #10368, #10380.  Refs #9806.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9985 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-07 23:02:48 +00:00
Justin Bronn 68f81c873d Fixed #10397 -- made GIS test runner compatible with changes in r9756.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9978 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-06 02:01:20 +00:00
Justin Bronn 9b8c712ca7 Fixed #10159 -- `F()` expressions now work on geographic fields. The tests are in `relatedapp`, which has been retrofitted to work with Oracle (minus the prior offending tests). I'm back.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9963 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-03 22:10:15 +00:00
Malcolm Tredinnick fdca9e55e8 Fixed #10395 -- Fixed more fallout from r9945.
(Simultaneously, stop django.contrib.gis using some internal attribute when
there's a perfectly good public property available to do the same thing.)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9960 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-03-03 02:45:15 +00:00
Justin Bronn 2b8e768b22 Fixed #9858 -- Added ability to use PostGIS template with GIS test runner via `POSTGIS_TEMPLATE` setting. Thanks to Aryeh Leib Taurog for feature suggestion and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9803 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-01 18:22:57 +00:00
Justin Bronn d982edff4b Now use `subprocess.Popen` instead of the deprecated os.popen3 to issue PostGIS test database creation commands.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9801 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-02-01 17:49:33 +00:00
Justin Bronn 547649f962 Fixed geographic admin to be compatible with `ModelAdmin.formfield_for_dbfield` changes in r9760.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9763 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-16 20:05:39 +00:00
Ian Kelly acfe5cc880 Fixed #6767: changed the way the Oracle backend fetches numbers to prevent decimals being returned as floats.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9750 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 20:39:09 +00:00
Justin Bronn f60d0f597a Forgot to actually enable the extent aggregate for Oracle.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9749 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 19:50:29 +00:00
Justin Bronn f671a5c961 Fixed incomplete merge of geographic aggregates; added support for `Extent` aggregate to Oracle spatial backend. Refs #3566.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9748 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 19:35:04 +00:00
Russell Keith-Magee cc4e4d9aee Fixed #3566 -- Added support for aggregation to the ORM. See the documentation for details on usage.
Many thanks to:
 * Nicolas Lara, who worked on this feature during the 2008 Google Summer of Code.
 * Alex Gaynor for his help debugging and fixing a number of issues.
 * Justin Bronn for his help integrating with contrib.gis.
 * Karen Tracey for her help with cross-platform testing.
 * Ian Kelly for his help testing and fixing Oracle support.
 * Malcolm Tredinnick for his invaluable review notes.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9742 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-15 11:06:34 +00:00
Justin Bronn 6c4e5f0f0e Fixed #9278, #9694 -- Geographic overlays now display in admin with right to left langauges; simplified transformation process in `OpenLayersWidget` to fix Ubuntu 8.10/Apache 2.2.9 crash; updated OpenLayers version to 2.7.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9733 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-13 02:08:26 +00:00
Justin Bronn 300752bd6c Return None for null date/time fields in OGR-supported data sources. Thanks to Ariel Mauricio Nunez Gomez for bug report and initial patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9711 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-07 20:21:19 +00:00
Justin Bronn 391736e737 Updated `GeoWhere` to be compatible with changes in r9700.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9702 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-05 22:16:12 +00:00
Justin Bronn 3cd1e80ae4 Fixed `check_geom` and `check_srs` to accept larger sized pointer addresses as returned by some platforms (including OpenBSD 4.4 and Fedora 8).
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9693 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-01-03 01:37:51 +00:00
Justin Bronn 50cd258a24 Fixed #9664 -- `LayerMapping` now works with MySQL spatial backends.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9688 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-26 20:04:11 +00:00
Justin Bronn d39540af92 Fixed #9892 -- support additional binary packages for GEOS & GDAL libs on OSX & Ubuntu platforms.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9686 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2008-12-26 16:02:45 +00:00