NieuwlandGeo/SLDReader

Custom shapes

Razi91 opened this issue · 1 comments

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.

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.