0

In my Geoserver project, I need to put each feature in a separate layer, and combine all these layers in one layer group.

The problem is when the number of features increases ( > 1,000 feature) the performance of displaying and querying the layer group degrades significantly compared to putting all the features in a single layer. I'm using Openlayers for the display.

The expected number of features is > 10,000 feature, so it will be a big performance issue.

What is the reason, and what is the solution?

5
  • 3
    can you explain why you need to put each feature into a separate layer? It seems unlikely that you can make this approach scale to 1000+ features
    – Ian Turton
    Commented Nov 26, 2017 at 12:12
  • I need to do that because, in short, to have my application behaves like Google Earth: each feature has its own tags, and can be shown/hidden individually.
    – Faz B
    Commented Nov 26, 2017 at 14:12
  • All GIS systems show/hide a whole layer at once, and have tags associated with layers not with features.
    – Faz B
    Commented Nov 26, 2017 at 14:13
  • 1
    Have you looked at filters applied to the layer
    – Ian Turton
    Commented Nov 26, 2017 at 14:38
  • Filters will not solve the problem of tagging each feature individually. Also it is a turn around solution for show/hide each feature individually.
    – Faz B
    Commented Nov 26, 2017 at 15:36

1 Answer 1

2

Simply put... you can forget about it with the current setup, each separate layer issues a query to the data storage, and that's likely what is killing you (either cost of SQL query, or opening the source file if it's a file based store, or the cost of HTTP communication if it's a service like SOLR, and so on).

You'd need some storage where the access cost is basically nil, like a fully in memory storage (which, if you only have 10000 features, it's quite doable). While there is a memory data store in GeoTools, it's not available in GeoServer as one would first need to solve the problem of how to load it initially, update it if necessary, and eventually persist changes. Or some in memory caching around a persisted data store, with similar issues.

If you are interested in getting something like that going please see this guide: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

4
  • I can go with the single layer way if a layer can accept more than one feature types (e.g points and lines). Is that possible?
    – Faz B
    Commented Nov 28, 2017 at 10:38
  • A layer has one "feature type" (e.g., one table) behind it, but GeoServer and spatial databases allow you to put as many geometry types as you want in the geometric column, just declare it as a generic geometry. Commented Nov 28, 2017 at 10:49
  • That means, I can create a layer that contains points, lines, and polygons, is that correct? If yes, would you please tell me how to do that in Geoserver.
    – Faz B
    Commented Nov 28, 2017 at 11:47
  • That is another question. But really, as said, just use a spatial database, and then create a column of type GEOMETRY without qualifying further the type Commented Nov 29, 2017 at 12:01

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