get location from query to use another Query using PostGIS/postgres

المشرف العام

Administrator
طاقم الإدارة
I want to retrieve a polygon within that a point is located. We know the following query will return the polygon that contains provided lat long position within that polygon

SELECT name, value, count, id from table_1 where ST_Within(ST_GeomFromText('POINT(90.78 23.56)'), geom)Now I want to use the long lat position that retrieved from another table. The longitude can be returned from the following query in another table

SELECT ST_X(ST_Transform (ST_SetSRID(way,3857), 4326)) from planet_osm_point WHERE name = 'Bluemoon Cafe'and for latitude

SELECT ST_Y(ST_Transform (ST_SetSRID(way,3857), 4326)) from planet_osm_point WHERE name = 'Bluemoon Cafe'Now I want to merge all the query into one. I am using the following query that return error.

SELECT name, value, count, id from table_1 where ST_Within(ST_GeomFromText('POINT('(SELECT ST_X(ST_Transform (ST_SetSRID(way,3857), 4326)) from planet_osm_point WHERE name = 'Bluemoon Cafe';)' '(SELECT ST_Y(ST_Transform (ST_SetSRID(way,3857), 4326)) from planet_osm_point WHERE name = 'Bluemoon Cafe';)')'), geom)How can I solve it?



أكثر...
 
أعلى