Your SlideShare is downloading. ×
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Requêtes osmosis + gis
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Requêtes osmosis + gis

805

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
805
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • http://datenkueche.com/osmlive/
  • Transcript

    • 1. Requêtes osmosis + GIS Frédéric Rodrigo <fred.rodrigo gmail.com> La Cantine - Paris 07/10/2011 – (c)left 2011 - CC-BY-SA v3.0 @
    • 2.
        osmosis
      • Charge un extract OSM en base
        • Prétraitement pour faire des requêtes
          • Ajout d'index sur les tags
          • 3. Ajout de colonne géométrique aux ways
    • 4.
        Schéma
        relations
        ways
        nodes
        way_nodes
        relation_members
    • 5.
        Schéma : nodes
      Colonne | Type | Modificateurs --------------+-----------------------------+--------------- id | bigint | non NULL version | integer | non NULL user_id | integer | non NULL tstamp | timestamp without time zone | non NULL changeset_id | bigint | non NULL tags | hstore | geom | geometry |
    • 6.
        Requête sur nodes & hstore
      • SELECT tags FROM nodes;
        • &quot;man_made&quot;=>&quot;water_tower&quot;, &quot;ele&quot;=>&quot;120&quot;
      • SELECT tags->’name’ FROM nodes;
        • &quot;L’assiette&quot;
      • SELECT tags->’name’ , tags->’ref:INSEE’ FROM nodes WHERE tags?’place’
        • &quot;Saint-Jean-de-Luz&quot; , &quot;64483&quot;
    • 7.
        Schéma : ways
      Colonne | Type | Modificateurs --------------+-----------------------------+--------------- id | bigint | non NULL version | integer | non NULL user_id | integer | non NULL tstamp | timestamp without time zone | non NULL changeset_id | bigint | non NULL tags | hstore | nodes | bigint[] | bbox | geometry | linestring | geometry | Colonne | Type | Modificateurs -------------+---------+--------------- way_id | bigint | non NULL node_id | bigint | non NULL sequence_id | integer | non NULL
    • 8.
        Requête sur ways
      • SELECT tags FROM ways;
        • &quot;building&quot;=>&quot;yes&quot;, &quot;wall&quot;=>&quot;no&quot;
      • SELECT tags->’name’ FROM ways;
        • &quot;Rue des Lilas&quot;
      • SELECT tags->’name’ , tags->’ref’ FROM ways WHERE tags?’highway’
        • &quot;Avenue Tiers&quot; , &quot;N 32&quot;
    • 9.
        Schéma : relations
      Colonne | Type | Modificateurs --------------+-----------------------------+--------------- id | bigint | non NULL version | integer | non NULL user_id | integer | non NULL tstamp | timestamp without time zone | non NULL changeset_id | bigint | non NULL tags | hstore | Colonne | Type | Modificateurs -------------+--------------+--------------- relation_id | bigint | non NULL member_id | bigint | non NULL member_type | character(1) | non NULL member_role | text | non NULL sequence_id | integer | non NULL
    • 10.
        Requête sur relations
        SELECT relation.id FROM relations JOIN relation_members ON relations.id = relation_members.relation_id AND relation_members.member_type = 'W' JOIN ways ON relation_members.member_id = ways.id WHERE relations.tags?'type' AND relations.tags->'type' = 'road' AND ways.tags?'highway' AND ways.tags->'highway' = 'service'
    • 11.
        Requêtes géospatiales
      • Extension PostGIS à Postgres
    • 19.
        Requête géospatiale
        SELECT po.id, MIN(ST_Distance(po.geom, po.pb) AS dist FROM nodes AS pb, nodes AS po WHERE pb.tags?'amenity' AND pb.tags->'amenity' = 'post_box' AND po.tags?'amenity' AND po.tags->'amenity' = 'post_office' AND GROUP BY po.id
        Utilisation des index
        En unité de référence
    • 20.
        Export géospatial
      • Pgsql2shp -> QGis
        SELECT id, tags->'source' AS source, ST_Simplify(linestring, 1e-3) AS geom FROM ways WHERE tags?'source' AND tags->'source' LIKE '%Cartographes Associés%'
        Export plus facilement manipulable dans QGis
        Cas des tags à valeurs multiples
    • 21.
        Manque junction=roundabout
      • Un giratoire c'est quoi ?
      Moins de 25 nodes Moins de 70m de diamètre Plus de 60% d'un cercle
    • 22.
        Manque junction=roundabout
      SELECT ways.id FROM ways WHERE -- tags ways.tags?'highway' AND (NOT ways.tags?'junction' OR ways.tags->'junction' != 'roundabout') AND -- geometry ST_NPoints(linestring) < 24 AND ST_MaxDistance(linestring,linestring) < 70 AND ST_Area(linestring) / ST_Area(ST_MinimumBoundingCircle(linestring)) > 0.6

    ×