Skip to content

Add geospatial expand_envelope function.#13616

Merged
mbasmanova merged 2 commits intoprestodb:masterfrom
jagill:expand
Nov 5, 2019
Merged

Add geospatial expand_envelope function.#13616
mbasmanova merged 2 commits intoprestodb:masterfrom
jagill:expand

Conversation

@jagill
Copy link
Contributor

@jagill jagill commented Oct 28, 2019

This creates an envelope that is the minimum bounding rectangle of a
Geometry, expanded by a float distance. This is vastly cheaper than
ST_Envelope(ST_Buffer(geometry, distance)), and significantly cheaper
than ST_Envelope(ST_Buffer(ST_Envelope(geometry), distance)).

== RELEASE NOTES ==

General Changes
-----------------
* Add expand_envelope function to return a geometry's envelope expanded by a distance.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like you are also fixing something here. Do you think it is worth extracing in a separate commit with an explanation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The hidden admixture is that I'm also allowing empty envelopes to be serialized. I can separate that out into another commit.

@arhimondr arhimondr requested a review from mbasmanova October 30, 2019 20:53
@jagill jagill force-pushed the expand branch 2 times, most recently from d85d4fd to 4ff4e35 Compare October 31, 2019 18:40
Copy link
Contributor

Choose a reason for hiding this comment

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

@jagill perhaps, check that distance is >= 0?

@jagill jagill changed the title Add ST_Expand function. Add geospatial expand_envelope function. Oct 31, 2019
@jagill jagill force-pushed the expand branch 2 times, most recently from 2975450 to fbc4535 Compare October 31, 2019 19:17
Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

@jagill Looks good % method name.

Copy link
Contributor

Choose a reason for hiding this comment

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

expand_envelope -> expandEnvelope

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: perhaps, include the value of distance in the error message to simplify troubleshooting

@mbasmanova
Copy link
Contributor

@jagill Would you fix the commit message: Add ST_Expand function. -> Add expand_envelope function

@mbasmanova mbasmanova self-assigned this Oct 31, 2019
@jagill jagill force-pushed the expand branch 2 times, most recently from 5d70a0f to d52264b Compare October 31, 2019 19:45
Previously, empty envelopes were not allowed to be serialized.
It will be useful to be able to serialize them for ST_Expand, so
this commit enables them.
This creates an envelope that is the minimum bounding rectangle of a
Geometry, expanded by a float distance.  This is vastly cheaper than
ST_Envelope(ST_Buffer(geometry, distance)), and significantly cheaper
than ST_Envelope(ST_Buffer(ST_Envelope(geometry), distance)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments