Skip to content

Fixed #11948 -- Added interpolate and project linear referencing methods #168

Closed
wants to merge 1 commit into from

3 participants

@claudep
Django member
claudep commented Jun 21, 2012

No description provided.

@akaariai
Django member

I don't know gis well enough to comment on the code of the patch.

But I have verified the patch as well as I can - that is, the gis test suite passes on postgis after applying this pull request, the docs build without warnings and the code looks to be good quality.

So, LGTM with the warning that I don't know what the code actually does :)

@jbronn
Django member
jbronn commented Sep 10, 2012

I'm going to review this; the PostGIS 2.0 requirements will probably need this, so it may come have to come in through a different PR.

@jbronn jbronn commented on the diff Sep 10, 2012
django/contrib/gis/geos/geometry.py
@@ -577,6 +577,16 @@ def envelope(self):
"Return the envelope for this geometry (a polygon)."
return self._topology(capi.geos_envelope(self.ptr))
+ def interpolate(self, distance):
+ if not isinstance(self, (LineString, MultiLineString)):
+ raise TypeError('interpolate only works on LineString and MultiLineString geometries')
+ return self._topology(capi.geos_interpolate(self.ptr, distance))
@jbronn
Django member
jbronn added a note Sep 10, 2012

If there's GEOS 3.1 (as on Ubuntu 10.04), however you'll need to raise a NotImplementedError.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jbronn
Django member
jbronn commented Sep 10, 2012

Did an initial review, and liked what I see so far. I need to check if there's a variable somewhere that makes it easier to check for GEOS revision in a way more granular than what was done for when prepared geometry support: a less than elegant GEOS_PREPARE global was used previously for version-based differences, if I recall correctly.

@jbronn
Django member
jbronn commented Sep 10, 2012

Yeah, there's already a GEOS_VERSION global; another approach would be to check for the existence of those functions on the capi module.

@claudep
Django member
claudep commented Sep 29, 2012

OK, I will use your suggestion of checking function availability on the capi module

@claudep
Django member
claudep commented Sep 29, 2012

Pushed in 2f6e00a

@claudep claudep closed this Sep 29, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.