<div dir="ltr">Hi<div><br></div><div>As a simple start, you can select geometries nearby click-coordinates by doing a sql-query like</div><div><br></div><div>SELECT ST_AsGeoJSON(geometry_column)</div><div>FROM geometry_table</div>
<div>WHERE ST_DWithin(geometry_column, ST_SetSRID(ST_Point(<lon>, <lat>), <srid>), <srid_distance>)</div><div><br></div><div>The geometry data will then be in a geojson string which is supported by openlayers (see <a href="http://dev.openlayers.org/docs/files/OpenLayers/Format/GeoJSON-js.html">http://dev.openlayers.org/docs/files/OpenLayers/Format/GeoJSON-js.html</a>). You can read more about the functions used in the SQL-query here <a href="http://postgis.net/docs/reference.html">http://postgis.net/docs/reference.html</a>.</div>
<div><br></div><div>Feel free to ask if you have any more questions</div><div>Åsmund</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 20, 2014 at 5:49 PM, dandrigo <span dir="ltr"><<a href="mailto:lcelati@latitude-geosystems.com" target="_blank">lcelati@latitude-geosystems.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear all,<br>
<br>
I would like code a web service with python. I have already imported<br>
several vector data (land cover) and one Digital Elevation Model<br>
(raster layer) into my postgresql/postgis database (server side).<br>
<br>
I succeed in connecting to my pg db via psycopg2 (postgresql 's python api)<br>
<br>
Client side, operators use a client application (Developed with PHP /<br>
javascript / openlayers).<br>
<br>
Objectives :  Client side, once the layer would be selected,and once<br>
the operators have clicked on the map  , they would like that usefull<br>
informations appear on the interface of the client application(kind of<br>
land cover, z of the DEM).<br>
<br>
<br>
=> Regarding my python script, i have to type a SQL query in order to<br>
select usefull informations of the db layers. And, of course, the<br>
information must  depend on geographic coordinates (Latitude<br>
Y/Longitute X).<br>
In a 2nd time, my script must  produce a result(JSon type) for the<br>
client side.<br>
<br>
<br>
It would be possible to help me regarding the coding in order to<br>
select usefull informations of the db layers. (depends on geographic<br>
coordinates x/y  ? Could you throw light for me regarding the way to<br>
do this SQL query ?<br>
<br>
In advance, thank you to throw light for me.<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://postgis.17.x6.nabble.com/psycopg-web-service-tp5006366.html" target="_blank">http://postgis.17.x6.nabble.com/psycopg-web-service-tp5006366.html</a><br>
Sent from the PostGIS - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br></div>