when I run a query on Postgis
select st_astext(ST_SetSRID(f.geom,4326) ),st_astext(st_centroid(ST_Transform(b.wkb_geometry,4326))) from a,b where ST_Distance_Sphere( ST_Transform(a.geom,4269),ST_Transform(b.wkb_geometry,4269))<10 limit 1;
I got this message on my screen print in infinite loop
Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRAPHY
to give you an idea about what I am getting when I fetch a.geom and wkb_geometry ?
select st_astext(ST_SetSRID(f.geom,4326) ),st_astext(st_centroid(ST_Transform(b.wkb_geometry,4326))) from a,b limit 1;
I got this :
POINT(-73.9798264975362 40.679599746172) | MULTIPOLYGON(((989878.855200246 186914.37490882,989831.404507741 186822.841299236,989812.018719748 186832.772053644,989859.469740331 186924.306319401,989878.855200246 186914.37490882))) |
what does that mean ? Does this affect results I am getting ?
Best Answer
You haven't provided enough information to allow us to help you more, so you'll have to debug this yourself. We can only suggest how to do the debugging.
First thing is to figure out which part of the query isn't working. Probably its the first part.
So instead of:
Just do one part at a time:
SELECT ST_AsText(ST_SetSRID(f.geom,4326));
If that causes the problem, inspect f.geom.
SELECT ST_AsText(f.geom), ST_SRID(f.geom) LIMIT 2;
Is that what you expected to see? Does the first part look like you expected (WGS-84 long/lat)? If not, did you possibly mean to project it instead of manually overwriting the SRID?
If the first part of the query works, do the same kind of debugging on the second part of query:
In regard to the last part of your question - if you don't understand all the operations in your query, the results probably don't do what you want.