I'm trying to build a system to show census tract on map. I used this example to import the census tract TIGER shapefile into DB, flatten the data on the column I need and managed to show a map with census tract using GeoServer, OpenLayers and OSM.

Now I need to add interaction where a user can select a census tract and be able to change the fill color. The example I followed creates a ol.Layer.Image layer which, I think, won't work here. I tried using a vector layer with a GeoJSON source from GeoServer but the browser is crashing trying to load 74K rows through JSON. I'm looking at vector tile example here but it doesn't cover dynamic style change from user interaction.

Is it possible to use OpenLayers/GeoServer with what I'm trying to do?

I'm new to these technologies and this is my first experiment with GIS.

  • 1
    Why is it loading 74k, it's too much to be displayed. geoserver can serve data for the current bbox only, which should reduce the data volume
    – neogeomat
    Commented May 22, 2018 at 18:10
  • The 74k records comes from the number of census tracts in the US. When creating the layer in GeoServer, I selected 'Compute from data' option for bounding box and left default values which covers the whole US. I think I can restrict the number of rows by using the 'maxFeatures' qs [link] (docs.geoserver.org/stable/en/user/services/wfs/reference.html) but the tracts are all over the place instead of zoom-in around one focal point. But I'm not sure if using Vector layer is the right approach for user interaction to fill color of a polygon.
    – jacob
    Commented May 22, 2018 at 18:23