Attribute table don't filter data with view port

18 views
Skip to first unread message
Assigned to stefan...@geosolutionsgroup.com by lorenzo...@geosolutionsgroup.com

Cristian Apostol

unread,
Jun 18, 2024, 10:16:46 AM (9 days ago) Jun 18
to mapstore-users
Hello,

My layers are stored in a Microsoft SQL Server database, when I'm opening the attribute table for a layer, for example ''tgNradm',  I can see all the records that are stored in that table (table1.png).

The problem appears when I'm trying to Filter data by the current viewport. When I try to move around or refresh the application the table stays empty (table2.png).


table2.png
table1.png

Lorenzo Natali

unread,
Jun 20, 2024, 4:35:17 AM (7 days ago) Jun 20
to mapstore-users
Hi,

I'm trying to guess a little bit, but in widgets there is a geometric filter too.
Maybe the integration with GeoServer and  Microsoft SQL Server has some issue. 
If you are able to copy the request of the WFS table that fails, you  can look for some existing known issue, or you can ask to the GeoServer's community some help

Cristian Apostol

unread,
Jun 21, 2024, 5:02:03 AM (6 days ago) Jun 21
to mapstore-users
I found the solution🎉

When you import a .shp into the SQL Server database, the imported file does not come with an SRID (the projection is not defined). To fix this you need to specify manually the SRID code

After that, you need to create a table using this script:
CREATE TABLE GEOMETRY_COLUMNS( F_TABLE_SCHEMA VARCHAR(30) NOT NULL, F_TABLE_NAME VARCHAR(30) NOT NULL, F_GEOMETRY_COLUMN VARCHAR(30) NOT NULL, COORD_DIMENSION INTEGER, SRID INTEGER NOT NULL, TYPE VARCHAR(30) NOT NULL, UNIQUE(F_TABLE_SCHEMA, F_TABLE_NAME, F_GEOMETRY_COLUMN), CHECK(TYPE IN ('POINT', 'LINESTRING', 'POLYGON', 'MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON', 'GEOMETRYCOLLECTION') ));

In this table you need to insert:
F_TABLE_SCHEMA - dbo in most cases
F_TABLE_NAME  - name of your table
F_GEOMETRY_COLUMN - column where is stored geometry in your table
COORD_DIMENSION -  2 is for coordinates that contain X,Y    -   3 is for coordinates that contain X,Y,Z  
SRID - 3844 (EPSG code)
TYPE  - POINT (or LINESTRING, POLYGON, etc)

After that you need to go GeoServer and set up the connection to your database, and in the bottom of the page you need to specify the geometry table (see the photo that is attached)

After all these steps you will be able to query your data and also to make a widget from your data.

Lorenzo Natali

unread,
Jun 24, 2024, 6:59:43 AM (3 days ago) Jun 24
to mapstore-users
Great to know,
thank you for sharing, 
this is very useful for users with the same problem.
And thank you for using MapStore.

Reply all
Reply to author
Forward
0 new messages