This project is read-only.

Filtering data for SharpMap

Topics: User Forum
Jan 18, 2007 at 11:34 AM

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!


Jan 18, 2007 at 6: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 8:57 PM
Thanks. I think I know what I have to do now :)
Jan 19, 2007 at 10: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?