What is the right syntax to define the DefinitionQuery

Topics: User Forum
Jul 31, 2008 at 7:48 PM
Hi community,

since  some days i have tested your project – i can say it is working well.

Now, I want to use Sharpmap to display geometries in conjunction with the MsSqlSpatial database tools. I use sharpmap with shapefiles at the moment. My first tests and steps to implementation are finished. But there is a problem to form the DefinitionQuery for the FeatureDataTables.

For the following example I‘d like to have a Dataset wich is filtered by a where clause before execution a spatial function. The result must filtered again by an intersection query. The function „ST.FilterQueryWhere“ works well inside the sql development tools
What is the right syntax to define the query?


    Dim d As SharpMap.Data.Providers.MsSqlSpatial = New SharpMap.Data.Providers.MsSqlSpatial(Conn here, theTable, geomColum, idColumn)
    Dim ds As SharpMap.Data.FeatureDataSet
    ds = New SharpMap.Data.FeatureDataSet
-->    d.DefinitionQuery = "ST.FilterQueryWhere#dbo#datatable#the_geom ([ST].[MakeEnvelope](bounding 4x,SRID),'the clause here')"
    d.ExecuteIntersectionQuery(bbox, ds)
    d = Nothing


I get an error like "near the ')' a boolean is expected"... Where is the documentation ;-)

Thanks in advance,

Jul 31, 2008 at 8:39 PM
Okay, I should use the DefinitionQuery like this .DefinitionQuery = "country = 'DEU'"