Filtering data for SharpMap

Topics: User Forum
Jan 18, 2007 at 10:34 AM
Hi,

I'm trying to constrain my data for SharpMap, and my first attempt (not really knowing how to do it!) produced:

myData.DefinitionQuery = "ST.MakeEnvelope(311667.753574452, 168321.2111899, 312732.700916047, 168900.648377004, -1)";

Which obviously doesn't work. Bear in mind that this is the only spatial database stuff I have ever done, so I haven't used the PostGIS provider in SharpMap.

Basically, I want to get the data between these limits:

Left: 311667.753574452
Bottom: 168321.2111899
Right: 312732.700916047
Top: 168900.648377004

I'm not entirely sure how to do this, but after trying to figure it out myself (with no documentation other than an outdated SharpMap help file, and a single post from yourself in the SharpMap developer forums), I'm pretty stumped :)

Any help is greatly appreciated!

Cheers,

Dylan
Jan 18, 2007 at 5:06 PM
Your definition query should be something that returns true - your current query returns an envelope.
So you basically need to specify a query checking whether your geometry column intersects this envelope.
Jan 18, 2007 at 7:57 PM
Thanks. I think I know what I have to do now :)
Jan 19, 2007 at 9:52 AM
Ok, I've done what I thought I needed to, but it had no effect whatsoever. Could anyone possible give me an example of the code required to achieve this please?