[OSM-dev] central elemstyles/MapFeatures.xml

80n 80n80n at gmail.com
Tue Nov 7 08:58:37 GMT 2006


On 11/7/06, Joerg Ostertag (OSM Munich/Germany) <openstreetmap at ostertag.name>
wrote:
>
> On Monday 06 November 2006 23:18, 80n wrote:
> > An earlier version version of Osmarender did have a mechanism to allow
> an
> > external style sheet file to be referenced.  I think it caused problems
> > with some tools because I didn't implement it properly, so it got
> dropped.
> >
> > It should be easy to re-introduce this.  The styles are separate from
> the
> > rules for this exact reason.
>
> Do you think osmarender could be changed to handle a style definition
> similar
> to the one i suggested? If yes, this would be great.


Most of the Osmarender rules file is straight SVG (http://www.w3.org/TR/SVG/).
The rest is just <rule> tags and some simple drawing instructions <line>,
<area>, <text>, <symbol>, <circle>.

The SVG style definition is very extensive and incorporates most of CSS.

Driving Osmarender from a rules file such as freemap.xml which only
describes line color and width would cripple Osmarender and throw away 90%
of its potential.

Apart from styles Osmarender uses scalable icons.  Using .pngs which are not
scalable would be a step backwards.

To make a common rule file we need to first establish a common rule file
schema.  To be sufficient for Osmarender this needs to support a lot more
than elemstyles.xml and freemap.xml currently do.

The first step should be to separate the style information from the rules
section.  This would enable a separate style file to be created for each
renderer.  This would allow Dubravko to make a style sheet using colours and
symbols that are appropriate for Croatia.  It would also enable multiple
rules to refer to the same style:

Something like:

<mapfeatures style='myStyleFile.xml'>
  <rule>
    <condition e="way" k="class" v="suburb" />
      <render class="residential" />
  </rule>
  <rule>
    <condition e="way" k="landuse" v="residential" />
      <render class="residential" />
  </rule>
  <rule>
  ...
  </rule>
</mapfeatures>


myStyleFile.xml
<style>
  <rendering class="residential">
    <scale min='1' max='10000'>
      <icon annotate="name,regioncode" src="place.png" />
    </scale>
    <scale min='10000' max='100000'>
      <icon annotate="name" src="city/small.png" />
    </scale>
  </rendering>
</style>


A lot of work would also be needed on the structure and semantics of the
<rule> elements to provide ways of expressing compound conditions etc.

80n





> > > <mapfeatures>
> > > >  <rule>
> > > >   <condition k="class" v="suburb" />
> > > >   <rendering>
> > > >     <scale_min>1  </scale_min>
> > > >     <scale_max>10000  </scale_max>
> > > >     <icon annotate="name,regioncode" src="place.png" />
> > > >   </rendering>
> > > >   <rendering>
> > > >     <scale_min>10000  </scale_min>
> > > >     <scale_max>100000  </scale_max>
> > > >     <icon src="city/small.png" />
> > > >   </rendering>
> > > >  </rule>
> > > >  <rule>
> > > >         ...
> > > >  </rule>
> > > > </mapfeatures>
>
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20061107/e8653029/attachment.html>


More information about the dev mailing list