Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #23804 -- Added RasterField for PostGIS #4339

Closed
wants to merge 1 commit into from

Conversation

yellowcap
Copy link
Contributor

  • I think this be for PostGIS >= 2.0 only, but I am not sure how to check for that
  • Lacks documentation since its a first draft
  • Very basic testing, needs more complete tests.

Refs #23804.

@timgraham
Copy link
Member

If it helps, we might consider dropping support for PostGIS 1.5 as its initial release was Feb. 2010.

@yellowcap
Copy link
Contributor Author

Rasters were only added to PostGIS in version 2.0, so any raster handling in previous versions would have to be through a regular binary field or so and would not support any spatial querying that could be implemented down the line for proper raster fields.

So for rasters, dropping support for PostGIS 1.5 would make sense.

@timgraham
Copy link
Member

PR to drop PostGIS 1.5 support: #4345

@timgraham
Copy link
Member

Claude believes we should keep PostGIS 1.5 support for 1.9, so you'll need to skip these tests there.

@yellowcap
Copy link
Contributor Author

Sounds good to me. Is there an example somewhere in the codebase for a db version check?

@timgraham
Copy link
Member

Yes, you can look at my proposed PR to drop PostGIS 1.5 or grep for "ops.spatial_version". By the way, I did email the geodjango mailing list to ask for objections to dropping PostGIS 1.5 support in 1.9, so maybe that decision isn't final.

@yellowcap yellowcap force-pushed the raster_field branch 7 times, most recently from 95c9d6d to e301eb9 Compare March 22, 2015 13:09
@auvipy
Copy link
Contributor

auvipy commented Mar 22, 2015

dropping support for postgis less then 2.0 in 1.9 is fine

@yellowcap yellowcap force-pushed the raster_field branch 4 times, most recently from 26f877c to b7fca21 Compare March 24, 2015 17:25
@yellowcap
Copy link
Contributor Author

Is there a way of limiting the import of test models based on the db backend?

The build keeps failing for mysql_gis because it tries to create the model table, see the end of the build log here.

I already wrapped the model defininition in a HAS_POSTGIS_2 statement, but that does not seem to have an effect.

from django.db import connection

HAS_POSTGIS_2 = (
hasattr(connection.ops, 'postgis') and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason for using vendor checks instead of the supports_raster feature flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was one, but not anymore. I updated the test to use the feature flag and moved the import of the test model into the test. That solved the problem. Thanks!

"""

description = "Raster Field"
geom_type = 'RASTER'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not ideal naming, but it leverages the geom_type attribute checks in the operations module, so renaming this to be more general (to include raster) would require updating the name in the geometry related code as well.

@yellowcap yellowcap force-pushed the raster_field branch 5 times, most recently from 1d5edac to 0e075bc Compare April 13, 2015 18:57
self.assertIn('path', indexes)
self.assertSpatialIndexExists('gis_neighborhood', 'path')

@skipUnlessDBFeature("supports_raster")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try to be consistent and use single quotes in most places (sorry existing code is inconsistent)

@yellowcap yellowcap force-pushed the raster_field branch 2 times, most recently from eb6b59c to b395e8f Compare May 28, 2015 15:30
@timgraham
Copy link
Member

Time to add docs?

@yellowcap yellowcap force-pushed the raster_field branch 3 times, most recently from 1c5a600 to db9afdd Compare June 18, 2015 13:09
@yellowcap
Copy link
Contributor Author

I added documentation for the RasterField. I hope I found all the relevant bits, I was not sure how to make clear that this is only supported for PostGIS backends, so I added it in one or two places where I found it relevant.

It would probably be good to also integrate the raster field into the GeoDjango Tutorial, but maybe that is another pull request?

@claudep
Copy link
Member

claudep commented Jun 18, 2015

Thanks! I'll let Tim review the language.

@yellowcap yellowcap force-pushed the raster_field branch 2 times, most recently from 4544ce5 to d069462 Compare June 19, 2015 07:28
@timgraham
Copy link
Member

Minor edits: http://dpaste.com/1YSTF0M and add release notes too?

@yellowcap
Copy link
Contributor Author

Integrated comments and added release notes.

@timgraham
Copy link
Member

please squash commits, thanks

Thanks to Tim Graham and Claude Paroz for the reviews and patches.
@yellowcap
Copy link
Contributor Author

Corrected those glitches and squashed commits.

@timgraham timgraham changed the title RasterField for PostGIS backends Fixed #23804 -- Added RasterField for PostGIS Jun 19, 2015
@timgraham
Copy link
Member

merged in b769bbd, thanks!

@timgraham timgraham closed this Jun 19, 2015
@claudep
Copy link
Member

claudep commented Jun 19, 2015

Awesome, congrats Daniel!

@yellowcap
Copy link
Contributor Author

Feels good! A big thanks you both for all the help!

@timgraham
Copy link
Member

Sorry, I forgot to try running the tests on systems without the GIS dependencies installed. Daniel, can you take a look? https://code.djangoproject.com/ticket/25011

@yellowcap
Copy link
Contributor Author

Here is a patch for it #4905

I think the same problem will also happen on systems that have only geos installed, so I think the RasterField import should be conditional on HAS_GDAL (which is kind of obvious, but have not thought about that before).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants