Widget error

19 views
Skip to first unread message
Assigned to lorenzo...@geosolutionsgroup.com by me

Cristian Apostol

unread,
Jun 18, 2024, 10:52:47 AM (9 days ago) Jun 18
to mapstore-users
When I'm trying to make a widget I receive this error.

There was an error during data retrieval: "java.lang.RuntimeException: java.io.IOException java.io.IOException'geometry::STGeomFromText' failed because parameter 2 is not allowed to be null."
 
The layer from which I want to create the widget is stored in the first place in a Microsoft SQL Server database and after is published in GeoServer.

I want to highlight that this problem is not appearing when I'm using data that is stored directly in GeoServer.


widget_error.PNG

Lorenzo Natali

unread,
Jun 20, 2024, 4:31:41 AM (7 days ago) Jun 20
to mapstore-users
Hi,
>  this problem is not appearing when I'm using data that is stored directly in GeoServer.
If so, probably it is a problem more related to GeoServer integration with microsoft SQL server database that with MapStore.

Cristian Apostol

unread,
Jun 21, 2024, 5:02:00 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.
geometry_metadata_table.PNG

Lorenzo Natali

unread,
Jun 24, 2024, 6:58:55 AM (3 days ago) Jun 24
to mapstor...@googlegroups.com
Great to know.
Thank you very much for sharing, this can be very helpful for users with the same problem.

--
You received this message because you are subscribed to the Google Groups "mapstore-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstore-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapstore-users/b1e111fb-2e59-487a-8398-7540f6856ecbn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages