Style Scripts in earth file

classic Classic list List threaded Threaded
3 messages Options
Mr Woo Mr Woo
Reply | Threaded
Open this post in threaded view
|

Style Scripts in earth file

Hi fellows,

I would like to define a stylesheet for a feature_geom and specialize the icon and stroke colors et alii.. based on feature properties. I have been considering using the script 'icon-script' and 'stroke-script', for instance, based on the example files of the project, but failed.

Please, could you provided me with some guidance to achieve this (if possible).

Thank you.

Mr Woo.

NOTE: Please find below the skeleton of my earth file:

<model name="MyModel" driver="feature_geom">

  <features name="MyFeatures" driver="ogr">
    <url>path.dbsqlite</url>
    <ogr_driver>SQLite</ogr_driver>
  </features>
               
               
  <styles type="text/css">               
  <style type="text/css"> default { icon-script: getIcon(); icon-scale: 5.0; icon-align: center-center; stroke-width: 0.9; stroke-script: getStrokeColor(); } </style>       
  <script language="javascript"> <![CDATA[ function getIcon() { var level = feature.properties.fl; var iconName = 'filled-point.png'; if ((level == 'FROM') || (level == 'TO')) { iconName = 'start-point.png'; } else { iconName = 'point.png'; } ??? } function getStrokeColor() { ??? } ]]> </script>                       
                       
way
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Style Scripts in earth file

Instead of icon-script, just use

  icon: getIcon();

Hope that helps.
Glenn Waldron / Pelican Mapping
Mr Woo Mr Woo
Reply | Threaded
Open this post in threaded view
|

Re: Style Scripts in earth file

Thank you very much Glenn.

Have a nice day.