Set styles of layer of swisstopo

207 views
Skip to first unread message

kaepten neisgei

unread,
May 16, 2015, 10:10:55 AM5/16/15
to geoadm...@googlegroups.com
Hi

Based on the example:
http://api3.geo.admin.ch/examples/geoadmin_catalog.html

I'd like to know, how to set the layer styles individually. I'm struggling here, read here , that I can't set styles of such layers(?) There is no problem to set styles to my own OL 3 Vector Layers. But how can I set different strokes or colors to layers of the type below? At least, how can I set the opacity...?

var schutz2 = ga.layer.create('ch.swisstopo.vec200-adminboundaries-protectedarea');

Thanks a lot for every hint!




Marc Monnerat

unread,
May 16, 2015, 5:15:33 PM5/16/15
to geoadmin-api
Hello Patrik,

For now, you can't change the style of the layers present in map.geo.admin.ch or the api3, because they are not vector (ol.layer.Vector)!

Most are WMTS (ol.source.WMTS)  layer, which are prerendered (small) images or WMS (ol.source.TileWMS), on-the-fly generated images. Maybe the only thing you may try is image processing with HTML5, but I doubt it will be efficient.

With WMS layer, you may eventually send a styled layer descriptor file which is a way to send user-defined style to a WMS server. I have to check if this feature is supported by the WMS server used by api3.geo.admin.ch (I guess not).

Regards,

Marc


--
You received this message because you are subscribed to the Google Groups "GeoAdmin API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geoadmin-api...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


kaepten neisgei

unread,
May 26, 2015, 7:26:12 AM5/26/15
to geoadm...@googlegroups.com
Thanks!
The on thing I found somwehre and tryed it out is "opacity" and this is working. At least...

Martin Maillard

unread,
Nov 2, 2015, 9:10:35 AM11/2/15
to GeoAdmin API
Hi Marc,

Do you confirm that SLD is not supported by api3.geo.admin.ch ? What are the alternatives ? Does swisstopo provide services serving vector data ? 
If not, I guess the only way is to buy the data on the toposhop and to setup our own server with custom styles ?

Thank you

Best regards

Martin

Marc Monnerat

unread,
Nov 3, 2015, 12:55:49 PM11/3/15
to geoadmin-api
Hello Martin,

Looks like you may invoke the WMS server 'wms.geo.admin.ch' with external SLDs (SLD=http)

1/ Original (hatch red, the Pixekarte is only for orientation)



2/ Custom style (blue stroke), via SLD





3/ Another style via SLD



So, for basic needs, it works, if you want complex symbol using Filter Encoding, it's maybe difficult wihtout knowing the exact attribute's name and possible values.
By the way, we are using Mapserver 7.0, so check their documentation.


Another way to alter colors of a layer is to cascade this WMS layer. Using Mapserver, you may use the PROCESSING directive. For instance, by inverting the order or a layer's band, you may turn, let say red into green.

Regarding, vector data, a few datasets are published via a WFS service: http://wfs.geo.admin.ch/?request=GetCapabilities&service=WFS&version=1.0.0

and some are also on http://data.geo.admin.ch/. As you are interested in environmental data, you may look at the environmental geodata of the FOEN (possibily a bit outdated)


Regards,

Marc

--
-- Τα πάντα ῥεῖ καὶ οὐδὲν μένει
Reply all
Reply to author
Forward
0 new messages