Giter Site home page Giter Site logo

Comments (7)

tbuckl avatar tbuckl commented on July 22, 2024

i think this:

SELECT p2.gid
FROM parcels p1, parcels p2
WHERE ST_Equals(p1.geom, p2.geom) AND
p1.gid <> p2.gid;

might be more efficient. will check the results against the other.

from bayarea_urbansim.

tbuckl avatar tbuckl commented on July 22, 2024

@janowicz @mkreilly Was the intention of stacking to group parcels that share an identical bounding box? That seems to be what the GROUP BY below does.

https://github.com/MetropolitanTransportationCommission/bayarea_urbansim/blob/master/data_regeneration/geom_aggregation.py#L243

See: http://postgis.net/docs/manual-2.1/ST_Geometry_EQ.html

I will ask someone that knows more to double-check.

If not, then we could substitute with ST_EQUALS, which checks the identity of the entire geometry.

It seems to be a question of precision though, because ST_EQUALS can be subject to rounding errors.

from bayarea_urbansim.

janowicz avatar janowicz commented on July 22, 2024

The intention was, as you said, to group parcels with the same geometry.
Ah, good to know that group by geom means only that their bounding boxes
are the same!

On Tue, Jun 30, 2015 at 10:31 AM, Tom Buckley [email protected]
wrote:

= != =


Reply to this email directly or view it on GitHub
#53 (comment)
.

from bayarea_urbansim.

tbuckl avatar tbuckl commented on July 22, 2024

@janowicz ok well for posterity, the GROUP BY clause actually performs better for what the intention is. i think this is because of the rounding errors in st_equals. perhaps we should think about using the hash of the bounding box as an identifier in the future?

here's an example of that, for posterity. the stacked_not_identical (shown as brownish in here -- blue+red) parcels are parcels that are = (group by) but not st_equals (to some other parcel in the parcels table).

image

i'll leave this issue open because i do still wonder if we can improve that query.

from bayarea_urbansim.

tbuckl avatar tbuckl commented on July 22, 2024

this query produces very similar results and makes use of indexes. i'll submit a PR with it:

SELECT p1.* into stacked
FROM parcels p1, parcels p2
WHERE p1.geom && p2.geom
AND p1.geom=p2.geom AND
p1.gid <> p2.gid;

from bayarea_urbansim.

janowicz avatar janowicz commented on July 22, 2024

@buckleytom Thanks!

from bayarea_urbansim.

tbuckl avatar tbuckl commented on July 22, 2024

This pull request closes this issue:

#54

from bayarea_urbansim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.