Thank you Andrea.
I've created a issue and I'll take a look on it when I get some time over.

Vänliga Hälsningar
Lukas
[http://www.decerno.se/images/decerno_logo_300.png]<http://www.decerno.se/>
Lukas Bergliden
Civilingenjör

Mobil             070 644 96 61         Electrum 234, 164 40 Kista
Direkt            08 630 75 09           Kistagången 16, 7 tr
________________________________
From: [email protected] [[email protected]] on behalf of Andrea Aime 
[[email protected]]
Sent: Wednesday, April 17, 2013 4:13 PM
To: Lukas Bergliden
Cc: [email protected]
Subject: Re: [Geoserver-users] Query returns wrong answer (sqlserver)

On Wed, Apr 17, 2013 at 3:38 PM, Lukas Bergliden 
<[email protected]<mailto:[email protected]>> wrote:
I checked the log and saw that this is the sql that is executed:
 SELECT * FROM (SELECT 
"Id","Innehavare","NuvarandeTillstaand","Publicerad","Adress","Postnummer","Ort","Vaaningsplan","Placering","Kommun","Laen","OevrigInfo","Geometri".STAsBinary()
 as "Geometri", ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) AS 
_GT_ROW_NUMBER  FROM "HjaertstartarPositionsVy" WHERE  
("Geometri".Filter(geometry::STGeomFromText('POINT (2006637.8011951 
8263826.9502469)', 900913)) = 1 AND 
"Geometri".STDistance(geometry::STGeomFromText('POINT (2006637.8011951 
8263826.9502469)', 900913))<50.0 AND "Innehavare" LIKE 'ica%' )) AS 
_GT_PAGING_SUBQUERY WHERE _GT_ROW_NUMBER <= 1000000

and after a while I figured out that I could get it to work correctly if I 
removed
"Geometri".Filter(geometry::STGeomFromText('POINT (2006637.8011951 
8263826.9502469)', 900913)) = 1

so that the query is:
SELECT * FROM (SELECT 
"Id","Innehavare","NuvarandeTillstaand","Publicerad","Adress","Postnummer","Ort","Vaaningsplan","Placering","Kommun","Laen","OevrigInfo","Geometri".STAsBinary()
 as "Geometri", ROW_NUMBER() OVER (ORDER BY CURRENT_TIMESTAMP) AS 
_GT_ROW_NUMBER  FROM "HjaertstartarPositionsVy" WHERE  
("Geometri".STDistance(geometry::STGeomFromText('POINT (2006637.8011951 
8263826.9502469)', 900913))<50.0 AND "Innehavare" LIKE 'ica%' )) AS 
_GT_PAGING_SUBQUERY WHERE _GT_ROW_NUMBER <= 1000000

So, basicly why does the DWitin create a Geometry.Filter()? And how can I stop 
it from doing so?

Ah yes, that does not seem right. You stop it by fixing the code that generates 
the sql, you can find it in geotools, in the jdbc-sqlserver module.
Patches welcomed, if not, at least open a ticket at 
jira.codehaus.org<http://jira.codehaus.org> (if you don't have an account, 
create it on xircles.codehaus.org<http://xircles.codehaus.org>)

Cheers
Andrea

--
==
GeoServer training in Milan, 6th & 7th June 2013!  Visit 
http://geoserver.geo-solutions.it<http://geoserver.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

-------------------------------------------------------
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to