2

I have a GeoServer layer that contains all buildings (houses, schools, library, museums) with their locations, data is stored in PostGIS database, and now creating a geoportal for showing that online with some symbols.

Is there a way to split this layer into multiple layers so I can use a built-in function, in OpenLayers, for showing and hiding layers?

I need that because for example if someone wants to see only schools he can turn all other layers off. If this can't be done can someone give me an idea what I should do?

My other idea is to try creating external checkboxes and then use them to show/hide features. I know that I can split them with an SQL view, but there is a lot of data for that. I am using OpenLayers 3.

  • Commenting as I'm really uncertain but could you try doing this with rendering styles? Also it's unclear to me what you mean about 'there is a lot of data for that' do you mean too much data for a view? – MichaelStoner Dec 17 '16 at 21:17
1

Basically you need to apply a filter to your data to create new layers. There are two ways to do this either in the database or in the renderer. Assuming that you have a lot of buildings in your layer I would go with the database option and use an SQL View to partition your data. GeoServer allows the creation of views via the user interface if you don't want to do it directly in postgis.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.