[Geoserver-users] Operation on mixed SRID geometries

Hello everybody,

I get an error on wms.
I’m able to see the wms as layer preview but clicking on a feature I got:
Internal error occurred java.io.IOException null ERROR: Operation on mixed SRID geometries

Actually the wms coming from a pgsql datastore, and I’m able to load the layer (it is a view)
in Qgis, there works fine, I can get the table information.

The geoserver version is 2.1.2, on ubuntu server 9.04.
The postgresql-postgis is a 9.1.9 - 2.0.

Here below the log output on viewing that layer:

2013-11-20 15:54:32,877 ERROR [geoserver.ows] -
org.geoserver.platform.ServiceException: Internal error occurred
at org.geoserver.wms.GetFeatureInfo.execute(GetFeatureInfo.java:177)
at org.geoserver.wms.GetFeatureInfo.run(GetFeatureInfo.java:122)
at org.geoserver.wms.DefaultWebMapService.getFeatureInfo(DefaultWebMapService.java:371)
at sun.reflect.GeneratedMethodAccessor2137.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.geoserver.ows.util.RequestObjectLogger.invoke(RequestObjectLogger.java:51)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy28.getFeatureInfo(Unknown Source)
at sun.reflect.GeneratedMethodAccessor2123.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.geoserver.ows.Dispatcher.execute(Dispatcher.java:630)
at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:234)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:23)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:74)
at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:49)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:394)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
at org.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:406)
at org.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:406)
at org.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:406)
at org.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:406)
at org.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:406)
at org.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:185)
at org.springframework.security.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:183)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: java.io.IOException
at org.geotools.data.store.ContentFeatureCollection.size(ContentFeatureCollection.java:354)
at org.geotools.data.crs.ForceCoordinateSystemFeatureResults.size(ForceCoordinateSystemFeatureResults.java:105)
at org.geoserver.wms.GetFeatureInfo.execute(GetFeatureInfo.java:278)
at org.geoserver.wms.GetFeatureInfo.execute(GetFeatureInfo.java:173)
… 82 more
Caused by: java.io.IOException
at org.geotools.jdbc.JDBCDataStore.getAggregateValue(JDBCDataStore.java:1289)
at org.geotools.jdbc.JDBCDataStore.getCount(JDBCDataStore.java:1219)
at org.geotools.jdbc.JDBCFeatureSource.getCountInternal(JDBCFeatureSource.java:409)
at org.geotools.data.store.ContentFeatureSource.getCount(ContentFeatureSource.java:413)
at org.geotools.data.store.ContentFeatureCollection.size(ContentFeatureCollection.java:327)
… 85 more
Caused by: org.postgresql.util.PSQLException: ERROR: Operation on mixed SRID geometries
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
at org.geotools.jdbc.JDBCDataStore.getAggregateValue(JDBCDataStore.java:1269)
… 89 more

Finally the same error occurs for all the layer from that db.

Thank you for any hints you can give me…

Kind regards

Eugenio

On Wed, Nov 20, 2013 at 3:54 PM, Eugenio Trumpy <frippe12573@anonymised.com>wrote:

Hello everybody,

I get an error on wms.
I'm able to see the wms as layer preview but clicking on a feature I got:
Internal error occurred java.io.IOException null ERROR: Operation on mixed
SRID geometries

This error happens when postgres is trying to apply a spatial index with a
geometry having one srid, but the
data has another.

Are you using a sql view? If so, maybe you setup the wrong srid when
creating the sql view?
If instead it's a normal view, may it be there are geometries in different
srids in it?
Postgis has a function to check the srid of a geometry, you should check.

Another possibility for the difference is that qgis is not using any
spatial filter... but that would be rather strange.

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

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

Hi Andrea,

well first of all, everything is very strange, since that layers was running for some months
before my today check.
Then the layer checked is actually a postgis view, where the field ‘the_geom’ is included.
In Qgis the layer is loaded correctly with the right SRID ‘4326’, moreover in the table view ‘geometry_column’
all the rows has 0 as value in srid field.

That probably is the reason why in the geoserver I haven’s null values for the layers coming from
that postgis datastore.
I just wonder how was able to work???..

My solution could be to fill-in the field srid in geometry_column view table,
can be right?

Regards

Eugenio


Date: Wed, 20 Nov 2013 16:13:03 +0100
Subject: Re: [Geoserver-users] Operation on mixed SRID geometries
From: andrea.aime@anonymised.com1107…
To: frippe12573@anonymised.com
CC: geoserver-users@anonymised.come.net

On Wed, Nov 20, 2013 at 3:54 PM, Eugenio Trumpy <frippe12573@anonymised.com> wrote:

Hello everybody,

I get an error on wms.
I’m able to see the wms as layer preview but clicking on a feature I got:
Internal error occurred java.io.IOException null ERROR: Operation on mixed SRID geometries

This error happens when postgres is trying to apply a spatial index with a geometry having one srid, but the
data has another.

Are you using a sql view? If so, maybe you setup the wrong srid when creating the sql view?
If instead it’s a normal view, may it be there are geometries in different srids in it?
Postgis has a function to check the srid of a geometry, you should check.

Another possibility for the difference is that qgis is not using any spatial filter… but that would be rather strange.

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


2013/11/20 Eugenio Trumpy <frippe12573@anonymised.com>

My solution could be to fill-in the field srid in geometry_column view
table,
can be right?

Try to republish the layer in Geoserver.
In the Native SRS filed it is showed 4326?

Do you get the error from the layer preview?

Cheers,

Stefano
---------------------------------------------------
41.95581N 12.52854E

http://www.linkedin.com/in/stefanoiacovella

http://twitter.com/#!/Iacovellas

Dear all,

probably Andrea is right, I checked the srid, and I see two of them,
4326 and null.
That is because 10 records have not the coordinates and then they have no a the_geom value, so I will check it soon.
But I modify the query for producing the view excluding the rows where the_geom is empty, so I remove and re-publish that layer
in geoserver but still doesn’t work.
What I’m doing wrong?

Thank you for now,

Kind regards

Eugenio


Date: Wed, 20 Nov 2013 16:13:03 +0100
Subject: Re: [Geoserver-users] Operation on mixed SRID geometries
From: andrea.aime@anonymised.com
To: frippe12573@anonymised.com
CC: geoserver-users@lists.sourceforge.net

On Wed, Nov 20, 2013 at 3:54 PM, Eugenio Trumpy <frippe12573@anonymised.com> wrote:

Hello everybody,

I get an error on wms.
I’m able to see the wms as layer preview but clicking on a feature I got:
Internal error occurred java.io.IOException null ERROR: Operation on mixed SRID geometries

This error happens when postgres is trying to apply a spatial index with a geometry having one srid, but the
data has another.

Are you using a sql view? If so, maybe you setup the wrong srid when creating the sql view?
If instead it’s a normal view, may it be there are geometries in different srids in it?
Postgis has a function to check the srid of a geometry, you should check.

Another possibility for the difference is that qgis is not using any spatial filter… but that would be rather strange.

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it


2013/11/20 Eugenio Trumpy <frippe12573@anonymised.com>

But I modify the query for producing the view excluding the rows where
the_geom is empty, so I remove and re-publish that layer
in geoserver but still doesn't work.
What I'm doing wrong?

If you run in postgis:

select distinct(ST_SRID(geom)) from <your_view>;

Does it return only 4326?

When you published again your view in GeoServer did it recognize the Native
SRS?

Cheers,

Stefano
---------------------------------------------------
41.95581N 12.52854E

http://www.linkedin.com/in/stefanoiacovella

http://twitter.com/#!/Iacovellas

Hi again,

after my query that exclude the lines where the_geom is null, your check query give back only 4326!
In the meanwhile I tried also the same datastore in another instance of geoserver, and it was working fine,
so I guessed the problem was on the first geoserver and I rebooted all tomcat,
now unfortunately tomcat is running but geoserver is still down…Starting geoserver from tomcat manager
I got:

FAIL - Application at context path /geoserver could not be started

so I 'm in trouble again…
Catilina log says:

20-nov-2013 17.25.40 org.geoserver.GeoserverInitStartupListener contextDestroyed
INFO: Unregistering JAI factory class com.sun.media.jai.tilecodec.GZIPTileEncoderFactory
20-nov-2013 17.25.40 org.geoserver.GeoserverInitStartupListener contextDestroyed
INFO: Cleaned up javabean caches
20-nov-2013 17.25.42 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
GRAVE: The web application [/geoserver] appears to have started a thread named [H2 TCP Server (tcp://146.48.99.237:38334)] but has failed to stop it. This is very likely to create a memory leak.
20-nov-2013 17.25.42 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
GRAVE: The web application [/geoserver] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@anonymised.com]) and a value of type [org.geotools.referencing.operation.projection.TransverseMercator.Provider] (value [PROJECTION[“Transverse_Mercator”]]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
20-nov-2013 17.25.42 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
GRAVE: The web application [/geoserver] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@anonymised.com]) and a value of type [org.geotools.referencing.wkt.Formatter] (value ) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.

Any hints???

regards

Eugenio


From: stefano.iacovella@anonymised.com
Date: Wed, 20 Nov 2013 17:13:11 +0100
Subject: Re: [Geoserver-users] Operation on mixed SRID geometries
To: frippe12573@anonymised.com
CC: andrea.aime@anonymised.com; geoserver-users@lists.sourceforge.net

2013/11/20 Eugenio Trumpy <frippe12573@anonymised.com>

But I modify the query for producing the view excluding the rows where the_geom is empty, so I remove and re-publish that layer
in geoserver but still doesn’t work.
What I’m doing wrong?

If you run in postgis:

select distinct(ST_SRID(geom)) from <your_view>;

Does it return only 4326?

When you published again your view in GeoServer did it recognize the Native SRS?

Cheers,

Stefano


41.95581N 12.52854E

http://www.linkedin.com/in/stefanoiacovella

http://twitter.com/#!/Iacovellas