[Geoserver-users] Spatial Queries using CQL in Geoserver

Hi,

I am trying to use CQL for spatial queries in Geoserver. But when I am giving the query DWITHIN(the_geom, POINT(-97 38), 200, kilometers), its not taking into account whether the unit is given in kilometers, meters,feet or any other unit, I mean the result remains the same. Can anyone please tell me, how to correct this.

Also, when I am trying to execute the query (using openlayers in Geoserver) CROSS(the_geom, LINESTRING(-120.55 47.43, -80.3 27)), its giving the error
code="Internal error"org.vfny.geoservers.wms**.WmsException**:Rendering process failed
Rendering process failed
side location conflict[(602.6500969678622 283.433559868993, NaN) ]
in the log file the following error is given:
11 Apr 14:10:45 ERROR [geoserver.ows] -
org.vfny.geoserver.wms.WmsException: org.vfny.geoserver.wms.WmsException: Rendering process failed
at org.vfny.geoserver.wms.responses.GetMapResponse.execute(GetMapResponse.java:442)
at org.geoserver.ows.adapters.ResponseAdapter.getMimeType(ResponseAdapter.java:48)
at org.geoserver.ows.Dispatcher.response(Dispatcher.java:692)
at org.geoserver.ows.Dispatcher.handleRequestInternal(Dispatcher.java:213)
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:627)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:265)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:107)
at org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:72)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:124)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:174)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.geoserver.filters.ReverseProxyFilter.doFilter(ReverseProxyFilter.java:183)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:41)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.vfny.geoserver.wms.WmsException: Rendering process failed
at org.vfny.geoserver.wms.responses.DefaultRasterMapProducer.produceMap(DefaultRasterMapProducer.java:409)
at org.vfny.geoserver.wms.responses.GetMapResponse.execute(GetMapResponse.java:421)
… 53 more
Caused by: com.vividsolutions.jts.geom.TopologyException: side location conflict [ (527.6500969679507, 257.433559868995, NaN) ]
at com.vividsolutions.jts.geomgraph.EdgeEndStar.propagateSideLabels(EdgeEndStar.java:299)
at com.vividsolutions.jts.geomgraph.EdgeEndStar.computeLabelling(EdgeEndStar.java:136)
at com.vividsolutions.jts.operation.relate.RelateComputer.labelNodeEdges(RelateComputer.java:297)
at com.vividsolutions.jts.operation.relate.RelateComputer.computeIM(RelateComputer.java:132)
at com.vividsolutions.jts.operation.relate.RelateOp.getIntersectionMatrix(RelateOp.java:130)
at com.vividsolutions.jts.operation.relate.RelateOp.relate(RelateOp.java:75)
at com.vividsolutions.jts.geom.Geometry.relate(Geometry.java:947)
at com.vividsolutions.jts.geom.Geometry.crosses(Geometry.java:746)
at org.geotools.filter.spatial.CrossesImpl.evaluate(CrossesImpl.java:51)
at org.geotools.filter.AndImpl.evaluate(AndImpl.java:55)
at org.geotools.renderer.shape.ShapefileRenderer.processShapefile(ShapefileRenderer.java:613)
at org.geotools.renderer.shape.ShapefileRenderer.processStylers(ShapefileRenderer.java:377)
at org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:1436)
at org.geotools.renderer.shape.ShapefileRenderer.paint(ShapefileRenderer.java:270)
at org.vfny.geoserver.wms.responses.DefaultRasterMapProducer.produceMap(DefaultRasterMapProducer.java:385)
… 54 more

siddharth raghuvanshi ha scritto:

Hi,

I am trying to use CQL for spatial queries in Geoserver. But when I am giving the query DWITHIN(the_geom, POINT(-97 38), 200, kilometers), its not taking into account whether the unit is given in kilometers, meters,feet or any other unit, I mean the result remains the same. Can anyone please tell me, how to correct this.

By adding code to support distance evaluations over geographic coordinates. It is simply not there.
There is code to do that in PostGIS 1.5, not sure how hard that
would be to port back to Java.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime ha scritto:

siddharth raghuvanshi ha scritto:

Hi,

I am trying to use CQL for spatial queries in Geoserver. But when I am giving the query DWITHIN(the_geom, POINT(-97 38), 200, kilometers), its not taking into account whether the unit is given in kilometers, meters,feet or any other unit, I mean the result remains the same. Can anyone please tell me, how to correct this.

By adding code to support distance evaluations over geographic coordinates. It is simply not there.
There is code to do that in PostGIS 1.5, not sure how hard that
would be to port back to Java.

Oh, for the curious, most of the relevant code seems to be here:
http://svn.osgeo.org/postgis/tags/1.5.1/liblwgeom/lwgeodetic.c

Hmmm.. GPL license? that might be a problem since if we wanted to
do a Java port it would have to become part of Geotools which is
LGPL...

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

On Sun, Apr 11, 2010 at 6:31 AM, Andrea Aime <aaime@anonymised.com> wrote:

Andrea Aime ha scritto:

siddharth raghuvanshi ha scritto:

Hi,

I am trying to use CQL for spatial queries in Geoserver. But when I am
giving the query DWITHIN(the_geom, POINT(-97 38), 200, kilometers), its
not taking into account whether the unit is given in kilometers,
meters,feet or any other unit, I mean the result remains the same. Can
anyone please tell me, how to correct this.

By adding code to support distance evaluations over geographic
coordinates. It is simply not there.
There is code to do that in PostGIS 1.5, not sure how hard that
would be to port back to Java.

Oh, for the curious, most of the relevant code seems to be here:
http://svn.osgeo.org/postgis/tags/1.5.1/liblwgeom/lwgeodetic.c

Hmmm.. GPL license? that might be a problem since if we wanted to
do a Java port it would have to become part of Geotools which is
LGPL...

Surely the GPL applies to the code implementation not the underlying algorithm?

Obviously I'm not a lawyer :slight_smile:

Ian
--
Ian Turton

Ian Turton ha scritto:

On Sun, Apr 11, 2010 at 6:31 AM, Andrea Aime <aaime@anonymised.com> wrote:

Andrea Aime ha scritto:

siddharth raghuvanshi ha scritto:

Hi,

I am trying to use CQL for spatial queries in Geoserver. But when I am
giving the query DWITHIN(the_geom, POINT(-97 38), 200, kilometers), its
not taking into account whether the unit is given in kilometers,
meters,feet or any other unit, I mean the result remains the same. Can
anyone please tell me, how to correct this.

By adding code to support distance evaluations over geographic
coordinates. It is simply not there.
There is code to do that in PostGIS 1.5, not sure how hard that
would be to port back to Java.

Oh, for the curious, most of the relevant code seems to be here:
http://svn.osgeo.org/postgis/tags/1.5.1/liblwgeom/lwgeodetic.c

Hmmm.. GPL license? that might be a problem since if we wanted to
do a Java port it would have to become part of Geotools which is
LGPL...

Surely the GPL applies to the code implementation not the underlying algorithm?

Obviously I'm not a lawyer :slight_smile:

Yeah, that's my interpretation. However I've just recently seen
a discussion about the H2 license which apparently mentions
obligations for ports to other languages. So... I guess it's
better to double check.

Besides that, the most obvious roadblock is to find someone with
the time to actually port that 2000-3000 lines of C code
to Java and make it work with all JTS geometries.
Hummm... that's going to take time

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.