CartoDB / observatory-extension

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

ERROR: Raster and geometry do not have the same SRID #250

Closed rafatower closed 7 years ago

rafatower commented 7 years ago

From https://github.com/CartoDB/camshaft/pull/254#issuecomment-278272812

we've seen some errors like this one: link removed

removed trace

Looking into the server logs, this is the raw trace in the server:

removed trace

rafatower commented 7 years ago

Here's the trace with the parameters used:

removed trace

rafatower commented 7 years ago

I can reproduce the problem directly on the OBS DB by issuing this query:

SELECT cdb_observatory.OBS_GetMeta(
  '01030000000100000005000000779E78CE168952C0CD28965B5A454440779E78CE168952C08A929048DB744440E6E786A6EC6B52C08A929048DB744440E6E786A6EC6B52C0CD28965B5A454440779E78CE168952C0CD28965B5A454440'::geometry,
  '[{"numer_id": "us.census.acs.B01003001"}]'::json
);
rafatower commented 7 years ago

The problem is that that geometry does not have SRID:

=> select st_srid('01030000000100000005000000779E78CE168952C0CD28965B5A454440779E78CE168952C08A929048DB744440E6E786A6EC6B52C08A929048DB744440E6E786A6EC6B52C0CD28965B5A454440779E78CE168952C0CD28965B5A454440'::geometry);
 st_srid 
---------
       0
(1 row)

So forcing it, it works:

=> SELECT cdb_observatory.OBS_GetMeta(
  st_setsrid('01030000000100000005000000779E78CE168952C0CD28965B5A454440779E78CE168952C08A929048DB744440E6E786A6EC6B52C08A929048DB744440E6E786A6EC6B52C0CD28965B5A454440779E78CE168952C0CD28965B5A454440'::geometry, 4326),
  '[{"numer_id": "us.census.acs.B01003001"}]'::json
);
-[ RECORD 1 ]------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
obs_getmeta | [{"id" : 1, "numer_id" : "us.census.acs.B01003001", "timespan_rank" : 1, "score_rank" : 1, "score" : 41.136233222069416598342505575193790578, "numer_aggregate" : "sum", "numer_colname" : "total_pop", "numer_geomref_colname" : "geoid", "numer_tablename" : "obs_9effa577f8b5d674d620dfbaf4aec55e70ac06b8", "numer_type" : "Numeric", "denom_aggregate" : null, "denom_colname" : null, "denom_geomref_colname" : null, "denom_tablename" : null, "denom_type" : null, "geom_colname" : "the_geom", "geom_geomref_colname" : "geoid", "geom_tablename" : "obs_87a814e485deabe3b12545a537f693d16ca702c2", "geom_type" : "Geometry", "geom_timespan" : "2015", "numer_timespan" : "2011 - 2015", "numer_name" : "Total Population", "denom_name" : null, "geom_name" : "US Census Tracts", "normalization" : null, "denom_id" : null, "geom_id" : "us.census.tiger.census_tract"}]

I wouldn't worry about this. Closing it...