CartoDB / crankshaft

CARTO Spatial Analysis extension for PostgreSQL
BSD 3-Clause "New" or "Revised" License
54 stars 20 forks source link

Add multipolygons and geometry collections support to PIA analyssis #165

Closed AbelVM closed 6 years ago

AbelVM commented 7 years ago

As requested by @andy-esch at https://github.com/CartoDB/crankshaft/issues/164

AbelVM commented 7 years ago

Absolutely. It's Monday in my brain

El 18 ene. 2017 19:09, "Andy Eschbacher" notifications@github.com escribió:

@ohasselblad commented on this pull request.

In src/pg/sql/13_PIA.sql https://github.com/CartoDB/crankshaft/pull/165#pullrequestreview-17287549 :

BEGIN dist := 1e999;

  • SELECT LEAST(dist, ST_distance(point, ST_ExteriorRing(polygon))::numeric) INTO dist;
  • SELECT CASE WHEN ST_Within(point,polygon) THEN 1 ELSE -1 END INTO within;
  • SELECT ST_NumInteriorRings(polygon) INTO holes;
  • IF holes > 0 THEN
  • FOR i IN 1..holes
  • LOOP
  • SELECT LEAST(dist, ST_distance(point, ST_InteriorRingN(polygon, i))::numeric) INTO dist;
  • END LOOP;
  • END IF;
  • pols := array_agg((ST_dump(polygon)).geom);
  • FOR j in 1..array_length(pols, 1);

@AbelVM https://github.com/AbelVM I think the CI is failing because of the semicolon on this line

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CartoDB/crankshaft/pull/165#pullrequestreview-17287549, or mute the thread https://github.com/notifications/unsubscribe-auth/AImXTXzSmAJXGxdZkIpZ4dIYBV9BbX0Rks5rTlVugaJpZM4LnGGO .

AbelVM commented 7 years ago

Green light! :green_heart:

andy-esch commented 7 years ago

Nice :) Adding to the latest release request -> https://github.com/CartoDB/crankshaft/issues/159