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

Separate geom from data calcs #267

Merged
merged 8 commits into from Mar 9, 2017
Merged

Conversation

talos
Copy link
Contributor

@talos talos commented Mar 9, 2017

  • Use a CTE to perform geometry intersections between user geometries and Observatory geometries

Copy link
Contributor Author

@talos talos left a comment

Choose a reason for hiding this comment

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

@michellemho Take a look at the code changes!

@@ -536,9 +536,12 @@ RETURNS TABLE (
)
AS $$
DECLARE
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@michellemho Starting here is where I made changes to use a CTE to do geometry intersections.

@@ -579,7 +582,20 @@ BEGIN
(unnest($1))->>'api_method' api_method,
(unnest($1))->'api_args' api_args
)
SELECT String_Agg(
SELECT
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@michellemho This is where the geometry intersections are defined.

' / Nullif(ST_Area(' || geom_tablename || '.' || geom_colname || '), 0))' ||
' END), 0) ' ||
' / (COUNT(*) / COUNT(distinct ' || geom_tablename || '.' || geom_geomref_colname || ')) '
' * pct_' || geom_tablename ||
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These parts where a lot of code was removed are possible because the geometry intersections were done in the CTE.

SELECT _geoms.id::INT, Array_to_JSON(ARRAY[%s]::JSON[])
FROM _geoms, %s
FROM _raw_geoms),
_procgeoms AS (SELECT _geoms.id, _geoms.geom, %s %s
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And this is the CTE!

@talos talos changed the base branch from faster-autotest to release-v-1.3.3 March 9, 2017 17:59
@talos talos changed the title [WIP] Separate geom from data calcs Separate geom from data calcs Mar 9, 2017
@talos talos merged commit c28cdeb into release-v-1.3.3 Mar 9, 2017
@talos talos deleted the separate-geom-from-data-calcs branch March 9, 2017 18:00
@talos talos mentioned this pull request Mar 9, 2017
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.

None yet

1 participant