GIS and Media fusion

"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

User Tools

Site Tools


geoinf14:postgis1

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
geoinf14:postgis1 [2014/12/09 09:39]
oertz [Spatial Query Language :: Part1]
geoinf14:postgis1 [2018/05/16 10:05] (current)
Line 22: Line 22:
 ===== Premiers pas ===== ===== Premiers pas =====
 (-> cf. documentation [[http://​postgis.refractions.net/​documentation/​manual-1.5/​reference.html|PostGIS Reference]]) (-> cf. documentation [[http://​postgis.refractions.net/​documentation/​manual-1.5/​reference.html|PostGIS Reference]])
-  - Quelles sont les aires des objets ? -> ST_Area2d<​code>​...</​code>​ +  - Quelles sont les aires des objets ? -> ST_Area2d<​code>​cf2</​code>​ 
-  - Quel sont les types géométriques des objets ? -> Geometrytype<​code>​...</​code>​ +  - Quel sont les types géométriques des objets ? -> Geometrytype<​code>​ 
-  - Quel est l'​objet géométrique le plus proche du pieton 2 ? -> ST_Distance<​code>​...</​code>​ +SELECT *, ST_Area(the_geom) FROM test WHERE ST_Geometrytype(the_geom) = '​ST_Polygon'​ 
-  - Qui est dans le bâtiment 2 ? -> ST_Within<​code>​...</​code>​+</​code>​ 
 +  - Quel est l'​objet géométrique le plus proche du pieton 2 ? -> ST_Distance<​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]])//
geoinf14/postgis1.1418114345.txt.gz · Last modified: 2018/05/16 10:05 (external edit)