CartoDB / crankshaft

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

Pole of inaccessiblity fails on multipolygon #164

Closed andy-esch closed 7 years ago

andy-esch commented 7 years ago

This table has state boundaries: maxp_usjoin.csv

Running CDB_PIA on that table gives back the following error:

{"error":["ExteriorRing: geom is not a polygon"]}

Query is: http://eschbacher.cartodb.com/api/v2/sql?q=SELECT%20cdb_crankshaft.CDB_PIA(the_geom)%20FROM%20eschbacher.maxp_usjoin

Extracting the first polygon from the MultiPolygon (using ST_GeometryN) allows the result to run. Since most polygon tables in carto store the geoms as multipolygon, we should have a function that accepts multipolygons as well as polygons. At the very least, there should be a check on input geom types to give back a less cryptic error.

AbelVM commented 7 years ago

Sure! I'd need to tweak the Signed_Dist function and we're done

andy-esch commented 7 years ago

Nice!