User:Kannix/ksandbox

From OpenStreetMap Wiki
Jump to navigation Jump to search

My first snippets of mapcss. Feel free to improve! Reference: JOSM MapCSSImplementation

waterways-cemt-classification-JOSM-style (NL-color-scheme)

<osm-script>
 <union>
 <union>
  <query type="way">
    <has-kv k="CEMT"/>
    <bbox-query s="51.90" n="53.50" w="4.00" e="7.25"/>
  </query>
  <query type="way">
    <has-kv k="boat" v="yes"/>
    <bbox-query s="51.90" n="53.50" w="4.00" e="7.25"/>
  </query>
  <query type="way">
    <has-kv k="motorboat" v="yes"/>
    <bbox-query s="51.90" n="53.50" w="4.00" e="7.25"/>
  </query>
 </union>
  <recurse type="way-node"/>
 </union>
 <print  mode="meta"/>
</osm-script>
 <osm-script>
  <union>
  <union>
   <query type="way">
     <has-kv k="CEMT"/>
     <bbox-query s="47" n="55" w="6.6" e="15"/>
   </query>
   <query type="way">
     <has-kv k="boat" v="yes"/>
     <bbox-query s="47" n="55" w="6.6" e="15"/>
   </query>
   <query type="way">
     <has-kv k="motorboat" v="yes"/>
     <bbox-query s="47" n="55" w="6.6" e="15"/>
   </query>
  </union>
   <recurse type="way-node"/>
  </union>
  <print  mode="meta"/>
 </osm-script>


  • JOSM-mapcss:
meta {
   title: "waterways-cemt-classification-style";
   description: "Intention is visualisation of navigable waterways for recreational boating";
   version: "2012-12-19";
   author: "kannix";
   link: "http://wiki.openstreetmap.org/wiki/User:kannix";
}

/* thin lines for Key:boat and Key:ship */
/* LightSkyBlue */
way[boat=yes],way[boat=permissive]
{
   width:2;
   color:#87CEFA;
}

/* GoldenRod */
way[ship=yes]
{
   width:2;
   color:#DAA520;
}

/* some decoration for motorboat=yes/no */
/* LimeGreen */
way[motorboat=yes]
{
   casing-width:2;
   casing-color:#32CD32;
   casing-dashes:10,20;
}

/* Red */
way[motorboat=no]
{
   casing-width:2;
   casing-color:#FF0000;
   casing-dashes:10,20;
}

/* CEMT NL color-scheme wms:http://geoservices.rijkswaterstaat.nl/vin?FORMAT=image/png&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=vin&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox} */
/* Yellow */
way[cemt="0"],way[CEMT="0"]
{
   width:4;
   color:#FFFF00;
}

/* ~Purple */
way[cemt=I],way[CEMT=I]
{
   width:4;
   color:#8400A8;
}

/* ~Fuchsia */
way[cemt=II],way[CEMT=II]
{
   width:4;
   color:#E600A9;
}

/* ~MediumBlue */
way[cemt=III],way[CEMT=III]
{
   width:4;
   color:#005CE6;
}

/* ~GreenYellow */
way[cemt=IV],way[CEMT=IV]
{
   width:4;
   color:#AAFF00;
}

/* ~OliveDrab */
way[cemt=Va],way[CEMT=Va]
{
   width:4;
   color:#4C7300;
}

/* ~Cyan */
way[cemt=Vb],way[CEMT=Vb]
{
   width:4;
   color:#73FFDF;
}

/* ~Brown */
way[cemt=VIa],way[CEMT=VIa]
{
   width:4;
   color:#A83800;
}

/* ~DarkGray */
way[cemt=VIb],way[CEMT=VIb]
{
   width:4;
   color:#9C9C9C;
}

/* ~OrangeRed */
way[cemt=VIc],way[CEMT=VIc]
{
   width:4;
   color:#FF5500;
}

/* DarkRed */
way[cemt=VII],way[CEMT=VII]
{
   width:4;
   color:#8B0000;
}

waterways-cemt-classification-JOSM-style (DE-line-scheme)

  • Key:CEMT
  • wsv.de
  • Unfortunately, the wsv-map does not use a color-scheme. On the above mentioned map, a multiple-line-scheme is shown...

OpenSeaMap-seamark:type=bridge-JOSM-style

<osm-script>
   <query type="node">
     <has-kv k="seamark:type" v="bridge"/>
     <bbox-query s="51.90" n="53.50" w="4.00" e="7.25"/>
   </query>
 <print  mode="meta"/>
</osm-script>
  • JOSM-mapcss:
meta {
   title: "OpenSeaMap-seamark:type=bridge-JOSM-style";
   description: "Intention is visualisation of navigable waterways for recreational boating";
   version: "2012-12-20_1";
   author: "kannix";
   link: "http://wiki.openstreetmap.org/wiki/User:kannix";
} 

/* seamark:type=bridge image @ http://wiki.openstreetmap.org/wiki/File:Clear_V.png */
/* [seamark:name]/[seamark:bridge:category]/[seamark:bridge:clearance_height]OR[seamark:bridge:clearance_height_closed]/[seamark:bridge:clearance_height_open]*/
way|z12-[seamark:type=bridge],node|z12-[seamark:type=bridge]
{
   icon-image: "Clear_V.png";
   icon-width: 25;
   icon-height: 25;
   icon-opacity: 1;
   text: eval
   (
       concat
       (
          (has_tag_key("seamark:name")?
            tag("seamark:name")
          :
            "name?")
          ,"/",
          (has_tag_key("seamark:bridge:category")?
            tag("seamark:bridge:category")
          :
            "cat?")
          ,"/",
          (has_tag_key("seamark:bridge:clearance_height")?
            tag("seamark:bridge:clearance_height")
          :
            (has_tag_key("seamark:bridge:clearance_height_closed")?
              tag("seamark:bridge:clearance_height_closed")
            :
              "-"
            )
          )
          ,"/", 
          (has_tag_key("seamark:bridge:clearance_height_open")?
            tag("seamark:bridge:clearance_height_open")
          :
            "-")
        )
    );
   text-position: line;
   text-offset: 18;
   font-size: 18;
}

/* seamark:type=bridge ANWB-large-scale-style */
node|z-13[seamark:type=bridge]
{
   icon-image: (eval(
     (has_tag_key("seamark:bridge:clearance_height")?
       (eval(
         ((tag("seamark:bridge:clearance_height")<2.4)?
             "closed.png"
         :
           ((tag("seamark:bridge:clearance_height")<=2.75)?
             "triangle.png"
           :
             ((tag("seamark:bridge:clearance_height")<=3.4)?
               "square.png"
             :
               ((tag("seamark:bridge:clearance_height")<=8.5)?
                 "star.png"
               :
                 ((tag("seamark:bridge:clearance_height")<12)?
                   "circle.png"
                 :
                   ((tag("seamark:bridge:clearance_height")>=12)?
                     "rectangle.png"
                   :
                     "none.png"
                   )
                 )
               )
             )
           )
         )
       ))
     :
       (has_tag_key("seamark:bridge:clearance_height_open")?
         (eval(
           ((tag("seamark:bridge:clearance_height_open")<2.4)?
               "closed.png"
           :
             ((tag("seamark:bridge:clearance_height_open")<=2.75)?
               "triangle.png"
             :
               ((tag("seamark:bridge:clearance_height_open")<=3.4)?
                 "square.png"
               :
                 ((tag("seamark:bridge:clearance_height_open")<=8.5)?
                   "star.png"
                 :
                   ((tag("seamark:bridge:clearance_height_open")<12)?
                     "circle.png"
                   :
                     ((tag("seamark:bridge:clearance_height_open")>=12)?
                       "rectangle.png"
                     :
                       "none.png"
                     )
                   )
                 )
               )
             )
           )
         ))
       :
           "none.png"
        )
     )
   ));
   icon-width: 15;
   icon-height: 15;
   icon-opacity: 1;
}

JOSM bridge preset

 <presets
   author="User:kannix" 
   shortdescription="bridges" 
   description="presets for adding bridge-objects to waterways for routing purpose" 
   version="2012-12-23"
   xmlns="http://josm.openstreetmap.de/tagging-preset-1.0">
   <group name="seamark:type=bridge" icon="presets/bridge.png">
     <item name="fixed bridge" icon="fixedbridge.png" type="node">
       <label text="use decimal point:" />
       <space />
       <label text="OpenSeaMap flavor:" />
       <key key="seamark:type" value="bridge" />
       <key key="seamark:bridge:category" value="fixed" />
       <text key="seamark:name" text="name" default="" delete_if_empty="true" />
       <text key="seamark:bridge:clearance_height" text="vertical clearance in meters(m)" default="" delete_if_empty="true" />
       <text key="seamark:bridge:clearance_width" text="horizontal clearance in meters(m)" default="" delete_if_empty="true" />
       <space />
       <label text="FreieTonne flavor:" />
       <combo key="obstacle" text="obstacle" display_values="bridge" values="bridge" default="" delete_if_empty="true" />
       <text key="obstacle_name" text="obstacle_name (alt)" default="" delete_if_empty="true" />
       <text key="maxheight" text="maxheight in meters(m)" default="" delete_if_empty="true" />
       <text key="maxsideheight" text="maxsideheight in meters(m)" default="" delete_if_empty="true" />
       <text key="maxwidth" text="maxwidth in meters(m)" default="" delete_if_empty="true" />
       <space />
       <text key="river:waterway_distance" text="river:waterway_distance (km)" default="" delete_if_empty="false" />
       <text key="source" text="source" default="" delete_if_empty="true" use_last_as_default="true"/>
       <space />
       <text key="image" text="image URL" default="" delete_if_empty="true" />
       <text key="wikipedia" text="Wikipedia" default="" delete_if_empty="true" />
       <space />
       <link text="Tag:seamark:type=bridge @ osm-Wiki" href="http://wiki.openstreetmap.org/wiki/Tag:seamark:type%3Dbridge" />
     </item>
     <item name="opening bridge" icon="drawbridge.png" type="node">
       <label text="use decimal point:" />
       <space />
       <label text="OpenSeaMap flavor:" />
       <key key="seamark:type" value="bridge" />
       <key key="seamark:bridge:category" value="opening" />
       <text key="seamark:name" text="name" default="" delete_if_empty="true" />
       <text key="seamark:bridge:clearance_height_closed" text="vertical clearance closed in meters(m)" default="" delete_if_empty="true" />
       <text key="seamark:bridge:clearance_width" text="horizontal clearance in meters(m)" default="" delete_if_empty="true" />
       <space />
       <label text="FreieTonne flavor:" />
       <combo key="waterway" text="waterway" display_values="drawbridge" values="drawbridge" default="" delete_if_empty="true" />
       <text key="maxwidth" text="maxwidth in meters (m)" default="" delete_if_empty="true" />
       <space />
       <text key="opening_hours" text="opening_hours" default="" delete_if_empty="true" />
       <text key="passage_time" text="passage_time (minutes)" default="" delete_if_empty="true" />
       <text key="phone" text="phone (+49 30 278823)" default="" delete_if_empty="true" />
       <text key="vhf" text="vhf-channel" default="" delete_if_empty="true" />
       <space />
       <text key="river:waterway_distance" text="river:waterway_distance (km)" default="" delete_if_empty="false" />
       <text key="source" text="source" default="" delete_if_empty="true" use_last_as_default="true"/>
       <space />
       <text key="image" text="image URL" default="" delete_if_empty="true" />
       <text key="wikipedia" text="Wikipedia" default="" delete_if_empty="true" />
       <space />
       <link text="Key:opening_hours @ osm-Wiki" href="http://wiki.openstreetmap.org/wiki/Key:opening_hours" />	
       <link text="Tag:seamark:type=bridge @ osm-Wiki" href="http://wiki.openstreetmap.org/wiki/Tag:seamark:type%3Dbridge" />
     </item>
         <item name="lifting bridge" icon="liftingbridge.png" type="node">
       <label text="use decimal point:" />
       <space />
       <label text="OpenSeaMap flavor:" />
       <key key="seamark:type" value="bridge" />
       <key key="seamark:bridge:category" value="lifting" />
       <text key="seamark:name" text="name" default="" delete_if_empty="true" />
       <text key="seamark:bridge:clearance_height_closed" text="vertical clearance closed in meters(m)" default="" delete_if_empty="true" />
       <text key="seamark:bridge:clearance_height_open" text="vertical clearance open in meters(m)" default="" delete_if_empty="true" />
       <text key="seamark:bridge:clearance_width" text="horizontal clearance in meters(m)" default="" delete_if_empty="true" />
       <space />
       <label text="FreieTonne flavor (there is no real lifting-bridge @ ft):" />
       <combo key="waterway" text="waterway" display_values="drawbridge" values="drawbridge" default="" delete_if_empty="true" />
       <text key="maxwidth" text="maxwidth in meters (m)" default="" delete_if_empty="true" />
       <space />
       <text key="opening_hours" text="opening_hours" default="" delete_if_empty="true" />
       <text key="passage_time" text="passage_time (minutes)" default="" delete_if_empty="true" />
       <text key="phone" text="phone (+49 30 275773)" default="" delete_if_empty="true" />
       <text key="vhf" text="vhf-channel" default="" delete_if_empty="true" />
       <space />
       <text key="river:waterway_distance" text="river:waterway_distance (km)" default="" delete_if_empty="false" />
       <text key="source" text="source" default="" delete_if_empty="true" use_last_as_default="true"/>
       <space />
       <text key="image" text="image URL" default="" delete_if_empty="true" />
       <text key="wikipedia" text="Wikipedia" default="" delete_if_empty="true" />
       <space />
       <link text="Key:opening_hours @ osm-Wiki" href="http://wiki.openstreetmap.org/wiki/Key:opening_hours" />	
       <link text="Tag:seamark:type=bridge @ osm-Wiki" href="http://wiki.openstreetmap.org/wiki/Tag:seamark:type%3Dbridge" />
     </item>
   </group>
 </presets>

OpenSeaMap-seamark:type=notice-JOSM-style

<osm-script>
   <query type="node">
     <has-kv k="seamark:type" v="notice"/>
     <bbox-query s="51.90" n="53.50" w="4.00" e="7.25"/>
   </query>
 <print  mode="meta"/>
</osm-script>
<osm-script>
   <query type="node">
     <has-kv k="seamark:type" v="notice"/>
     <bbox-query s="51.30" n="53.75" w="6.65" e="10.35"/>
   </query>
 <print  mode="meta"/>
</osm-script>


  • JOSM-mapcss (text):
meta {
   title: "CEVNI-notice-mark-style";
   description: "";
   version: "2013-01-22";
   author: "kannix";
   link: "http://wiki.openstreetmap.org/wiki/User:kannix";
}

/* show [seamark:notice:information]*/
node|z12-[seamark:notice:information]
{
   text:"seamark:notice:information";
   text-offset-x: 0;
   text-offset-y: 11;
   font-size: 10;
}