NieuwlandGeo / SLDReader

SLD styling for online mapping libraries
https://nieuwlandgeo.github.io/SLDReader
MIT License
75 stars 21 forks source link

Custom shapes #75

Open Razi91 opened 4 years ago

Razi91 commented 4 years ago

There are many wellknownshapes that are not so 'well known', used in QGIS and GeoServer, like equilateral_triangle or half_square. WDYT: should them be hard-coded in this lib, or there should be made an endpoint to add them in your app code? It could be solved with a simple map.

Some shapes requires more ellastic style system (like half_square) in openLayers, I'm working on it.

ajkopinga commented 4 years ago

I think that better interoperability with QGIS is a good argument for hard-coding these in the SLDReader library.

If someone wants to add other wellknown names, I think that adding a custom factory method might be the way to go. Perhaps something like this:

SLDReader.registerWellKnownSymbol('mycustomsymbol', function(size, olStroke, olFill) {
  // returns a new OpenLayers Image subclass (like Circle or Regularshape)
  // that uses the given size, olStroke and olFill.
})

And then store the factory function for 'mycustomsymbol' inside a map in wellknown.js, like you suggested.