Skip to content

SLD styling for Leaflet geojson Layers

License

Notifications You must be signed in to change notification settings

fbuccioni/Leaflet.SLD

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proof of concept only

Leaflet.SLDStyler

Apply styling from 1.1.0 SLD-File to a GeoJSON layer.

Rules can be ORed or ANDed. The following comparisions are possible:

  • ogc:PropertyIsEqualTo
  • ogc:PropertyIsNotEqualTo
  • ogc:PropertyIsLessThan
  • ogc:PropertyIsGreaterThan
  • ogc:PropertyIsLessThanOrEqualTo
  • ogc:PropertyIsGreaterThanOrEqualTo

The following PolygonSymbolizer properties are applied:

  • stroke
  • stroke-width
  • stroke-opacity
  • fill-opacity
  • fill
  • stroke-opacity
  • stroke-dasharray
  • stroke-linejoin
  • stroke-linecap

Also see the unit tests for what is possible.

Example:

var SLDStyler = new L.SLDStyler(SLDXmlOrText);

var geojsonLayer = L.geoJson(jsonObject, {
   style: SLDStyler.getStyleFunction()
}).addTo(map);

To be done:

  • Symbolizers beside Polygon
  • more styling properties and comparisions

About

SLD styling for Leaflet geojson Layers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 95.9%
  • HTML 4.1%