V2 Help Needed

Jul 28, 2008 at 4:45 PM

I am working with version 2.0. For the following 2 code snipets, I get the results / errors listed below. The shapefile is valid, the latitude, longitude are valid for the shapefile area. For the first one, the shapefile is opened, but I cannot get to the attributes. For the second approach, the buffer command fails.
PLEASE GIVE ME AN IDEA OF WHY NEITHER APPROACH WORKS, THANKS.

1)

FeatureQueryExpression

query = FeatureQueryExpression.Intersects(gFactory.CreateExtents2D(lonMin, latMin, lonMax, latMax));

IFeatureDataReader reader = sf.ExecuteFeatureQuery(query);

bool bj = reader.Read();

//LOAD THE INFORMATION INTO A TABLE, ONE WAY TO ACCESS SHAPEFILE ATTRIBUTES

FeatureDataTable dataTable = new FeatureDataTable("ShapeFile test", gFactory);

dataTable.Load(reader,

LoadOption.OverwriteChanges, null);

***** NO RECORDS ARE RETURNED INTO dataTable. LONMIN, LATMIN, LONMAX, LATMAX ARE ALL VALID. sf IS VALID.

2)

ICoordinateFactory

coordFactory = gFactory.CoordinateFactory;

ICoordinate pCoord = coordFactory.Create(lon, lat);

IPoint pPoint = gFactory.CreatePoint(pCoord);

IGeometry pGeom = pPoint.Buffer(1.0, GeoAPI.Operations.Buffer.BufferStyle.Round);

******** ERROR ON BUFFER COMMAND
System.NullReferenceException: Object reference not set to an instance of an object.
at GisSharpBlog.NetTopologySuite.Index.Strtree.StrTree`2.StrNode.ComputeBounds()
at GisSharpBlog.NetTopologySuite.Index.AbstractNode`2.get_Bounds()
at GisSharpBlog.NetTopologySuite.Index.Strtree.StrTree`2.StrNode.Intersects(IExtents`1 bounds)
at GisSharpBlog.NetTopologySuite.Index.Strtree.AbstractStrTree`2.<Query>d__0.MoveNext()
at GisSharpBlog.NetTopologySuite.Noding.MonotoneChainIndexNoder`1.intersectChains()
at GisSharpBlog.NetTopologySuite.Noding.MonotoneChainIndexNoder`1.Node(IEnumerable`1 inputSegmentStrings)
at GisSharpBlog.NetTopologySuite.Operation.Buffer.BufferBuilder`1.computeNodedEdges(IEnumerable`1 bufferSegStrList, IPrecisionModel`1 precisionModel)
at GisSharpBlog.NetTopologySuite.Operation.Buffer.BufferBuilder`1.Buffer(IGeometry`1 g, Double distance)
at GisSharpBlog.NetTopologySuite.Operation.Buffer.BufferOp`1.bufferOriginalPrecision()
at GisSharpBlog.NetTopologySuite.Operation.Buffer.BufferOp`1.computeGeometry()
at GisSharpBlog.NetTopologySuite.Operation.Buffer.BufferOp`1.GetResultGeometry(Double distance)
at GisSharpBlog.NetTopologySuite.Operation.Buffer.BufferOp`1.Buffer(IGeometry`1 g, Double distance, BufferStyle endCapStyle)
at GisSharpBlog.NetTopologySuite.Geometries.Geometry`1.Buffer(Double distance, BufferStyle endCapStyle)
at GisSharpBlog.NetTopologySuite.Geometries.Geometry`1.GeoAPI.Geometries.ISpatialOperator.Buffer(Double distance, BufferStyle endCapStyle)

.Create(IEnumerable`1 coordinates)

Jul 29, 2008 at 9:06 PM
Solved this by using a mixture of SharpMap 0.9 and TF.NET.  Abandoned attempt at SharpMap2.0 for now.
Jul 30, 2008 at 6:01 AM
hi Surrounded.
how does SharpMap 0.9 support TF.NET. Should i use Converter class like NTS Converter?
Jul 30, 2008 at 8:19 PM
now doing most of my work using TF.NET within web services.  the SharpMap webservice returns info to the TF.Net webservice when necessary.   Looking forward to official release of SharpMap v2.