CartoDB / observatory-extension

BSD 3-Clause "New" or "Revised" License
6 stars 4 forks source link

Certain geometries cause intersection errors #248

Closed talos closed 7 years ago

talos commented 7 years ago

Notable in the performance tests comparing OBS_GetData to OBS_GetMeasure for counties (complex) at 3000. Error:

ERROR:  Error performing intersection: TopologyException: found non-noded intersection between LINESTRING (179.735 51.855, 179.718 51.8413) and LINESTRING (179.727 51.8464, 179.718 51.8413) at 179.71791868794949 51.841303957203266
CONTEXT:  PL/pgSQL function cdb_observatory.obs_getdata(geomval[],json,boolean) line 203 at RETURN QUERY

Precise query to reproduce (provided you've produced tables as outlined in the gist):

WITH source AS (
  SELECT ST_SetSRID(ST_Extent(the_geom), 4326) AS extent,
         ARRAY_AGG((the_geom, cartodb_id)::geomval) AS geomvals,
         COUNT(*)::int as numgeoms
  FROM my_complex_geometries
  WHERE cartodb_id <= 3000
), meta as (
  SELECT cdb_observatory.obs_getmeta(
    extent,
    '[{"numer_id": "us.census.acs.B01003001", "normalization": "prenormalized"}]',
    1, 1, numgeoms
  ) meta FROM source
)
SELECT cdb_observatory.obs_getdata(geomvals, meta)
FROM source, meta;
talos commented 7 years ago

@andy-esch could you paste a link to your brooklyn poverty table that's causing problems here?

andy-esch commented 7 years ago

Data here: https://team.carto.com/u/eschbacher/tables/brooklyn_poverty/public

Tried to get the following measures:

data_obs_measures = [{'numer_id': 'us.census.acs.B01003001'},
                     {'numer_id': 'us.census.acs.B15003017', 'denominator': 'predenominated'},
                     {'numer_id': 'us.census.acs.B19013001'},
                     {'numer_id': 'us.census.acs.B17001002', 'denominator': 'predenominated'}]

Getting failures on OBS_GetData with this error: 'cdb_dataservices_client._obs_getdata(5): [cartodb_user_a6f0d0fe-4f4f-4217-8150-22b0010fe409_db] REMOTE ERROR: Exception: Error trying to OBS_GetData while using the artisanal function obs_augment_table.

talos commented 7 years ago

Resolved with 1.3.3 release.