I'm hoping there's at least one other Spatial user in here!
I'm trying to use the Intersection SpatialAnalysisProjection but the
only option available, as far as I can see, is to perform an
intersection against an existing property, whereas I want to return
the intersection between my geometry and an IGeometry passed in as a
parameter.
What I'd like to do is:
return this.Session.CreateCriteria<Boundary>()
.Add(Expression.Eq("Force", force))
.Add(Expression.Eq("Code", code))
.Add(SpatialExpression.Intersects("Geometry", bound))
.SetProjection(
SpatialProjections.Intersection("Geometry",bound)
)
.List<IGeometry>();
where bound is an IGeometry.
I've tried specifiying the Intersection explicitly:
.SetProjection(
new SpatialAnalysisProjection("Geometry",
SpatialAnalysis.Intersection, bound)
)
but that fails as I'm not setting "anotherPropertyName" in the
constructor, "arguments" is set instead.
I've tried modifying the SpatialAnalysisProjection so it says
if (this.IsBinaryOperation())
{
if (String.IsNullOrEmpty(this.anotherPropertyName) &&
this.arguments.Length > 0 && this.arguments[0] is
GeoAPI.Geometries.IGeometry)
{
sqlString = spatialDialect.GetSpatialAnalysisString
(column1, this.analysis,Parameter.Placeholder);
}
else
{
string column2 = criteriaQuery.GetColumn(criteria,
this.anotherPropertyName);
sqlString = spatialDialect.GetSpatialAnalysisString
(column1, this.analysis, column2);
}
}
but then it's not taking in the parameter, so it asks for 4 parameters
& I'm only passing 3.
The SQL I'm trying to generate it
"SELECT b.Geometry.STIntersection(@p0)
FROM dbo.Boundaries b
WHERE
b.Geometry.STIntersects(@p0)=1 AND
b.for...@p1 AND
b.co...@p2"
I'm using the NHibernate.Spatial.MsSql2008.MsSql2008GeometryDialect
and the latest trunk version of the library.
Can anyone please help??
Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---