"The explosive growth of the GeoWeb and geographic information has made GIS powerful media for the general public to communicate, but perhaps more importantly, GIS have also become media for constructive dialogs and interactions about social issues." - Sui & Goodchild
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
geoinf14:postgis1 [2014/12/09 11:20] oertz [Premiers pas] |
geoinf14:postgis1 [2018/05/16 10:05] (current) |
||
---|---|---|---|
Line 26: | Line 26: | ||
SELECT *, ST_Area(the_geom) FROM test WHERE ST_Geometrytype(the_geom) = 'ST_Polygon' | SELECT *, ST_Area(the_geom) FROM test WHERE ST_Geometrytype(the_geom) = 'ST_Polygon' | ||
</code> | </code> | ||
- | - Quel est l'objet géométrique le plus proche du pieton 2 ? -> ST_Distance<code>...</code> | + | - Quel est l'objet géométrique le plus proche du pieton 2 ? -> ST_Distance<code> |
- | - Qui est dans le bâtiment 2 ? -> ST_Within<code>...</code> | + | SELECT genre, ST_Distance(the_geom, (SELECT the_geom FROM test WHERE id = 2)) as dist FROM test |
+ | WHERE id <> 2 ORDER BY dist LIMIT 1 | ||
+ | |||
+ | OU | ||
+ | |||
+ | SELECT t1.* FROM test t1, test t2 WHERE t2.genre LIKE 'pieton2' | ||
+ | AND ST_Distance(t1.the_geom,t2.the_geom) = ( | ||
+ | SELECT min(ST_Distance(t1.the_geom, t2.the_geom)) FROM test t1, test t2 | ||
+ | WHERE t1.genre LIKE 'pieton2' AND t2.genre <> 'pieton2' | ||
+ | ) | ||
+ | </code> | ||
+ | - Qui est dans le bâtiment 2 ? -> ST_Within<code> | ||
+ | SELECT * FROM test WHERE genre like 'pieton%' | ||
+ | AND ST_WithIn(test.the_geom, (SELECT the_geom FROM test WHERE genre LIKE 'batiment2')); | ||
+ | </code> | ||
//(source: [[http://www.davidgis.fr|Jean David Techer]])// | //(source: [[http://www.davidgis.fr|Jean David Techer]])// |