How can I limit the number of features I see in the bounding box with a WMS layer? - postgresql

I set up a PostGIS database that I added in GeoServer via a parameterized SQL view. I used Leaflet to display this layer via wms and it works fine.
Now I would like to limit the number of features I see in the bounding box (25 maximum in my case).
I had a hope with the maxFeatures vendor parameter for wms proposed in geoserver but apparently it controls the number of features on each tile not in the bouding box. I also tried to add a LIMIT 25 at the end of my SQL view but it affects the number of features on the whole map not in the bouding box.
Is there a way to do what I want with a wms layer?
Thanks,

Related

Calculate areas of new features in merged layer in QGIS

I have merged four different layers into one new one in QGIS, but I want this layer to have different information then the old layers. I want all the buffered 'islands' to have a different ID and a calculated area. However, now in the attribute table I just see four features, one for each layer that I merged. Is there a way to update the attribute table to consist of new features (one for each 'island')?
This is what the layer looks like:
And this is what the attribute table now looks like:
And this is what I want (the 5th and 6th column especially):
You must create a feature for each monopart geometry, you can achieve this using the 25.1.18.46. Multipart to singleparts tool, and then use the field calculator to get the area, you can find here how to calculate area Calculating polygon areas in shapefile using QGIS.

Is there a function to select and show certain features only in print composer?

I have a feature layer with points. I have three pages in my print composer. On one of my pages, I only want to show points that fall within a certain value range. First, I tried locking the style on the pages where I want to display all my points.
Then, I went to the Query Builder of the layer I want to select points from, and I created an expression to display only points from a range:
The problem is that this selection modifies the points shown on all my pages in print composer, even the ones where I locked the layers and style for layers. The only alternative solution I can think of is to select the points I want to show, create a new feature layer with those selected points, and then show that feature layer on my page in print composer. However I'd like to know if there's another way to do this without creating a new feature layer each time I want to filter the points I show in print composer.
There's another way. The points change because when you define a query, basically you define what features will be loaded to the project. So if you use categorized symbology you can define that some feature will be not displayed, but they will stay loaded in the project.
Here you can find how to use this type of symbology: Classifying Nominal Data

Is there an option to remove duplicate point labels within a distance in Mapbox Studio?

I'm using Mapbox Studio to label some point features (from a GeoJSON layer I uploaded) in a style, and there are some duplicate points located nearby each other:
Are there any options in Mapbox Studio to remove the duplicate labels automatically? For example, some other mapping programs have the option to remove duplicate labels within a specified distance (pixels or map units). Is this available in Mapbox Studio (or failing that, in Mapbox-GL-JS)?
Mapbox Studio does not provide a way to remove the duplicate labels automatically. You could work with a filter to manually filter out duplicates by writing a relatively complex expression, although this is not really the intended use case of expressions. You could also add a duplicate: true property to duplicated point features in your source data, but since this would require manipulating your source data, you might as well remove the duplicates from the source data instead of taking this approach.
That being said, you could consider clustering your data and styling the clusters so that a cluster looks the same as any individual point. This example shows how to create and style clusters using Mapbox GL JS. Here is a JSFiddle that heavily modifies this example to cluster closely-located points, and style the clusters in the same way that individual points are styled: https://jsfiddle.net/uo216fxz/ (you will need to add your own Mapbox access token in order to view the result). Text labels are added with the point count for each cluster containing more than one point, so that you can easily see that clusters and single points are identical aside from the labeling.
You will likely need to customize several properties (such as clusterRadius, clusterMaxZoom, etc) beyond what is provided in the linked JSFiddle, to be more specific to your source data.

How can I create a filled map with custom polygons in Tableau given point data?

In one TDE, I have individual posts from a hyperlocal social network with lat/long data. In the other TDE, I have polygons for Chicago's community areas.
How can I shade those community areas according to the number of records that were posted within its boundaries?
I'd like to essentially look up the community area by lat/long since I don't have the community area data within the first TDE to perform a join. Is there some other way to generate these shaded polygons given the data I already have? Is there another mapping tool that could do this for less than hundreds of dollars, if Tableau is not the answer?
Here's my workbook on Tableau Public.
You could load both data sets into Postgres. Add the PostGIS extension, so you can do geospatial queries to map posts to polygons. The connect Tableau to Postgres to create your visualization. One step at a time.

Postgis: How to build query which returns points within box initially and then all the other points?

There is code which get from database points in bounding box for rendering on browser. Also displays list of points with attributes (name etc.)
But, when filter will be applied to the dataset I may get big count points (example around 50000). Rendering 50000 points by browser may cause performance problem. Therefore in my opinion need to apply paging algorithm (by LIMIT and OFFSET). But, first need render filtered points within browser box and then all the other.
UPD:
I found this variant:
SELECT gs.id, gs.name, ST_Contains(ST_GeomFromText('POLYGON(...)', 4326), gs.point) as contains
FROM geoms as gs
WHERE gs.name LIKE '%Berlin%'
ORDER BY contains DESC
LIMIT 50
The query you have will work for what you need but are you sure you need to display 50k points most of which are outside of the window? The standard aproach would be querying the points inside the browser box and a little around it and then load the rest when the position changes.