Many thanks Andrea. 

 

It turns out that our GEOMETRY_COLUMNS table has GEOMETRY_TYPE instead of the 
column that geotools is expecting: TYPE. 

 

Patricia

 

From: Andrea Aime <andrea.a...@geosolutionsgroup.com> 
Sent: November 25, 2022 6:42 AM
To: pkn...@forteconsulting.ca
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] SQL Server points layer always classified as 
"Other Geometry" and GSR/ArcGIS read it as polygon?

 

Hi Patricia,

what you tried should be the way to go, that is, creating the geometry metadata 
table and filling it with the expected information.

That is indeed the only way a geometry type can be recognized in SQL Server.

Code performing that lookup is here 
<https://github.com/geotools/geotools/blob/48e5b5ba93720beaa8dc3abb38e05e7c655a0efc/modules/plugin/jdbc/jdbc-sqlserver/src/main/java/org/geotools/data/sqlserver/SQLServerDialect.java#L362>
 , as you can see there is some logging going on: you can switch GeoServer 
logging profile to "GEOTOOLS_DEVELOPER_LOGGING" and see which queries are being 
used to find the geometry type.

 

Mind that fiddling with the table contents after GeoServer has determined the 
table structure once won't help much, as the results are cached.

After making any change in the geometry table, I'd recommend you go to the 
status page and press the "clear" button to force it to drop all caches and 
database connections, and start clean.

 

Cheers

Andrea

 

On Fri, Nov 25, 2022 at 1:33 AM Patricia Kneen <pkn...@forteconsulting.ca 
<mailto:pkn...@forteconsulting.ca> > wrote:

Good afternoon. I am trying to figure out how to publish my SQL Server point 
data in Geoserver as Points, rather than “Other Geometry”.

 

I have tried with many versions of Geoserver (2.15 – 2.22) and a whole variety 
of options, but I cannot seem to convince Geoserver that the layer contains 
regular old points. I am working with real data and have done a number of 
quality checks, but to be sure I came up with a simple test case to confirm 
what I am seeing. Below is the test case in case anyone is interested in trying 
it for themselves.

 

I have created a table called singlepoint which contains, as expected, a single 
record with a Shape column that is a single point. 

create table singlepoint (ID int, Shape geometry);

 

I then inserted a point and made sure that SQL Server recognizes it as a point 
with a valid SRID:

select Shape.STX, Shape.STY, Shape.STGeometryType(), Shape.STSrid from 
singlepoint;

X                                             Y                                 
             SType    SRID

-13754366.933777            6159721.47460994           Point     102100

 

I inserted a record into the geometry_columns table:

f_table_catalog                 f_table_schema                 f_table_name   
f_geometry_column       coord_dimension            srid                
geometry_type qgis_pkey

myazdb                                 dbo                                      
  singlepoint          Shape                                   0                
                              102100  POINT                   ID

 

I created a simple Microsoft SQL Server Store in Geoserver using all of the 
defaults and specifying “geometry_columns” as the metadata table.

 

When I publish the singlepoint table as a layer, it invariably gets the “Other 
Geometry” icon in the layer list and layer preview. The default style is the 
generic style instead of “point”. The ramifications of this is that when I try 
to view the data using the GSR community plugin, it tries to read it as a 
polygon.

 

Is there any way to explicitly declare this layer as point layer within 
Geoserver? I believe I have done everything on the SQL Server side to ensure 
that it is defined as a point layer. 

 

Many thanks in advance for your help,

 

Patricia

 

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net 
<mailto:Geoserver-users@lists.sourceforge.net> 
https://lists.sourceforge.net/lists/listinfo/geoserver-users




 

-- 

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit  <http://bit.ly/gs-services-us> http://bit.ly/gs-services-us for more 
information.
==

Ing. Andrea Aime 
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax:     +39 0584 1660272

mob:   +39  339 8844549

 

 <https://www.geosolutionsgroup.com/> https://www.geosolutionsgroup.com/

 <http://twitter.com/geosolutions_it> http://twitter.com/geosolutions_it

-------------------------------------------------------


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa 
che ogni circostanza inerente alla presente email (il suo contenuto, gli 
eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i 
destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per 
errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei 
comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed 
and may contain information that is privileged, confidential or otherwise 
protected from disclosure. We remind that - as provided by European Regulation 
2016/679 “GDPR” - copying, dissemination or use of this e-mail or the 
information herein by anyone other than the intended recipient is prohibited. 
If you have received this email by mistake, please notify us immediately by 
telephone or e-mail

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to