[Tagging] [OSM-talk] emergency=*

Ross Scanlon info at 4x4falcon.com
Fri Jul 30 16:26:42 BST 2010


> Well done.  Pretty much none of the others do.  I look forward to your
> patches :)

Heres the patch for the default.style for osm2pgsql

node,way   emergency      text         nocache,polygon

Wasn't worth a diff patch as it's only one line.  (30 seconds)
 
> Mapnik for instance has manual rules - they will need to be changed.
> Worse than that osm2pgsql (the import tool) only imports certain keys
> so implementing emergency=* requires a complete reimport of the
> database - about 30 hours even on very good hardware.  Then the
> changes need to be tested and deployed.  I can get to 3 or 4 hours of
> actual developed work without even trying.

Probably should have used a diff patch but anyway heres a new file for mapnik rules in inc/ dir  (5 minutes most of which was spent getting a copy of mapnik from svn)


Could be called layer-emergency-points.xml.inc

-----------------------------------------------------------------------
<Style>
     <Rule>
      &maxscale_zoom17;
      <Filter>[emergency]='ambulance_station'</Filter>
      <PointSymbolizer file="&symbols;/ambulance.p.16.png" />
    </Rule>
     <Rule>
      &maxscale_zoom17;
      <Filter>[emergency]='police_station'</Filter>
      <PointSymbolizer file="&symbols;/police.p.16.png" />
    </Rule>
    <Rule>
      &maxscale_zoom17;
      <Filter>[emergency]='fire_station'</Filter>
      <PointSymbolizer file="&symbols;/firestation.p.16.png" />
    </Rule>
</Style>

<Layer name="emergency-points" status="on" srs="&osm2pgsql_projection;">
    <StyleName>points</StyleName>
    <Datasource>
      <Parameter name="table">
      (select way,amenity,shop,tourism,highway,man_made,access,religion,waterway,lock,historic,emergency
      from &prefix;_point
      where emergency is not null
         or shop is not null
         or tourism in ('alpine_hut','camp_site','caravan_site','guest_house','hostel','hotel','museum','viewpoint')
         or highway in ('bus_stop','traffic_signals','ford')
         or man_made in ('mast','water_tower')
         or historic='memorial'
         or waterway='lock'
         or lock='yes'
      ) as points</Parameter>
      &datasource-settings;
    </Datasource>
</Layer>
<Layer name="emergency-points-poly" status="on" srs="&osm2pgsql_projection;">
    <StyleName>points</StyleName>
    <Datasource>
      <Parameter name="table">
      (select way,amenity,shop,tourism,highway,man_made,access,religion,waterway,lock,historic,emergency
      from &prefix;_polygon
      where emergency is not null
         or shop is not null
         or tourism in ('alpine_hut','camp_site','caravan_site','guest_house','hostel','hotel','museum','viewpoint')
         or highway in ('bus_stop','traffic_signals')
         or man_made in ('mast','water_tower')
         or historic='memorial'
      ) as points</Parameter>
      &datasource-settings;
    </Datasource>
</Layer>
--------------------------------------------------------------------------------


And now the osm.xml file (30 seconds)

 <Rule>
  <Filter>[amenity] = 'police'</Filter>
   &maxscale_zoom17;
  <TextSymbolizer name="name" fontset_name="book-fonts" size="10" fill="#734a08" dy="10" halo_radius="1" wrap_width="30"/>
 </Rule>
 <Rule>
  <Filter>[amenity] = 'fire_station'</Filter>
  &maxscale_zoom17;
  <TextSymbolizer name="name" fontset_name="book-fonts" size="10" fill="#734a08" dy="9" halo_radius="1" wrap_width="30"/>
 </Rule>


replaced by

 <Rule>
  <Filter>[emergency] = 'police_station'</Filter>
   &maxscale_zoom17;
  <TextSymbolizer name="name" fontset_name="book-fonts" size="10" fill="#734a08" dy="10" halo_radius="1" wrap_width="30"/>
 </Rule>
 <Rule>
  <Filter>[emercency] = 'fire_station'</Filter>
  &maxscale_zoom17;
  <TextSymbolizer name="name" fontset_name="book-fonts" size="10" fill="#734a08" dy="9" halo_radius="1" wrap_width="30"/>
 </Rule>
  



Total time 6 minutes

Hundreds of hours, yeah right.

The program I've been talking about uses osm2pgsql and mapnik so I'm well aware of them.

If your smart you could probably add the emergency data without having to totally rerun osm2pgsql.


-- 
Cheers
Ross



More information about the Tagging mailing list