Bienvenue sur PostGIS.fr

Bienvenue sur PostGIS.fr , le site de la communauté des utilisateurs francophones de PostGIS.

PostGIS ajoute le support d'objets géographique à la base de données PostgreSQL. En effet, PostGIS "spatialise" le serverur PostgreSQL, ce qui permet de l'utiliser comme une base de données SIG.

Maintenu à jour, en fonction de nos disponibilités et des diverses sorties des outils que nous testons, nous vous proposons l'ensemble de nos travaux publiés en langue française.

source: trunk/workshop-foss4g/spatial_relationships_exercises.rst @ 1

Revision 1, 3.3 KB checked in by djay, 8 years ago (diff)

Initial import of the svn tree

Section 11: Spatial Relationships Exercises

Here's a reminder of the functions we saw in the last section. They should be useful for the exercises!

Also remember the tables we have available:

  • nyc_census_blocks
    • name, popn_total, boroname, the_geom
  • nyc_streets
    • name, type, the_geom
  • nyc_subway_stations
    • name, the_geom
  • nyc_neighborhoods
    • name, boroname, the_geom

Exercises

  • "What is the geometry value for the street named 'Atlantic Commons'?"

    SELECT the_geom
      FROM nyc_streets
      WHERE name = 'Atlantic Commons';
    
    01050000202669000001000000010200000002000000093235673BE82141F319CD89A22E514170E30E0ADFE82141CB2D3EFFA52E5141
    
  • "What neighborhood and borough is Atlantic Commons in?"

    SELECT name, boroname
    FROM nyc_neighborhoods
    WHERE ST_Intersects(
      the_geom,
      '01050000202669000001000000010200000002000000093235673BE82141F319CD89A22E514170E30E0ADFE82141CB2D3EFFA52E5141'
    );
    
        name    | boroname
    ------------+----------
     Fort Green | Brooklyn
    
  • "What streets does Atlantic Commons touch?"

    SELECT name
    FROM nyc_streets
    WHERE ST_Touches(
      the_geom,
      '01050000202669000001000000010200000002000000093235673BE82141F319CD89A22E514170E30E0ADFE82141CB2D3EFFA52E5141'
    );
    
         name
    ---------------
     S Oxford St
     Cumberland St
    
    ./spatial_relationships/atlantic_commons.jpg
  • "Approximately how many people live on (within 50 meters of) Atlantic Commons?"

    SELECT Sum(popn_total)
      FROM nyc_census_blocks
      WHERE ST_DWithin(
       the_geom,
       '01050000202669000001000000010200000002000000093235673BE82141F319CD89A22E514170E30E0ADFE82141CB2D3EFFA52E5141',
       50
       );
    
    1186
    
Note: See TracBrowser for help on using the repository browser.