Hello Everyone

I have been working on adding spatial lookups for the RasterField in the 
GIS module.

https://github.com/django/django/pull/5460#issuecomment-152606283

I would like to get feedback regarding API design for the lookups.

The challenge is that one needs to specify two parameters for the lookup: 
the raster itself and a band index.

I think everything should default to the first band, as many rasters only 
have one band. For the special cases, an index has to be specified.

On the right hand side (rhs) the proposal is to use a syntax similar to the 
existing distance lookups, providing a tuple: (raster, band_index). That 
follows previous art and should be ok.

But on the left hand side (lhs) its less clear to me what to do.

For instance, to compare band 2 from a raster field "elevation" with a 
geometry, I can see two options

A specify the index with a double underscore:

elevation__2__intersects=geom

B pass the band index on the rhs:

elevation__intersects=(geom, 2)

The current implementation in the PR above uses the second option. But I 
have doubts because that mixes the lhs with the rhs.

Here are my questions:

- Are there other options for the api that shoudl be considered?
- If not, which of the two approaches would be better?

Thanks,

Daniel

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a67874c5-f1d4-44f1-a0c6-97765544125a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to