GeometryLayer with only 1 point problem

Topics: SharpMap v2.0, WinForms Controls
Nov 2, 2009 at 8:25 AM

Hi,

I'm using SharpMap v2.0 and I have a problem. When I tried to open only 1 layer with only 1 point throws this exception

if (Double.IsNaN(x) || Double.IsNaN(y) || Double.IsNaN(w))
            {
                throw new InvalidOperationException("Vertex components can't be NaN.");
            }

when i created the layer it has some extent.

the call stack is:

ManagedBufferedCoordinate.dll!NetTopologySuite.Coordinates.BufferedCoordinateFactory.getVertexInternal(double x = NaN, double y = NaN, double z = NaN, double w = 1.0) Line 1005    C#
     ManagedBufferedCoordinate.dll!NetTopologySuite.Coordinates.BufferedCoordinateFactory.getVertexInternal(double x = NaN, double y = NaN, double w = 1.0) Line 993 + 0x32 bytes    C#
     ManagedBufferedCoordinate.dll!NetTopologySuite.Coordinates.BufferedCoordinateFactory.getVertexInternal(double x = NaN, double y = NaN) Line 988 + 0x29 bytes    C#
     ManagedBufferedCoordinate.dll!NetTopologySuite.Coordinates.BufferedCoordinateFactory.Create(double x = NaN, double y = NaN) Line 152 + 0x1d bytes    C#
     ManagedBufferedCoordinate.dll!NetTopologySuite.Coordinates.BufferedCoordinateFactory.GeoAPI.Coordinates.ICoordinateFactory.Create(double x = NaN, double y = NaN) Line 337 + 0x1d bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.convertCoordinate(SharpMap.Rendering.Rendering2D.Point2D point = {[Point2D] (NaN, NaN)}) Line 1562 + 0x55 bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.ViewEnvelopeInternal.get() Line 501 + 0x4e bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.RenderFeatureLayer(SharpMap.Layers.IFeatureLayer layer = {fujtu8}, SharpMap.Presentation.RenderPhase phase = Normal) Line 1037 + 0x8 bytes    C#
     SharpMap.Presentation.WinForms.dll!SharpMap.Presentation.WinForms.MapPresenter.RenderFeatureLayer(SharpMap.Layers.IFeatureLayer layer = {fujtu8}, SharpMap.Presentation.RenderPhase phase = Normal) Line 103 + 0xe bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.RenderLayer(SharpMap.Layers.ILayer layer = {fujtu8}, SharpMap.Presentation.RenderPhase phase = Normal) Line 980 + 0x27 bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.RenderAllLayers(SharpMap.Presentation.RenderPhase phase = Normal) Line 948 + 0x3c bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.RenderAllLayers() Line 925 + 0xd bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.setViewMetricsInternal(SharpMap.Rendering.Rendering2D.Size2D newViewSize = {Width: 1399, Height: 913}, GeoAPI.Coordinates.ICoordinate newCenter = {(1,1125369292536E-308, 1,1125369292536E-308)}, double newWorldWidth = 3.4095052881178256E-308) Line 1498 + 0x8 bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.setViewEnvelopeInternal(GeoAPI.Geometries.IExtents2D newEnvelope = {Extents [0 - 2,2250738585072E-308, 0 - 2,2250738585072E-308]}) Line 1415 + 0x7a bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.ZoomToWorldBoundsInternal(GeoAPI.Geometries.IExtents2D zoomBox = {Extents [0 - 2,2250738585072E-308, 0 - 2,2250738585072E-308]}) Line 705 + 0xb bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.ZoomToExtentsInternal() Line 659 + 0x35 bytes    C#
     SharpMap.dll!SharpMap.Presentation.Presenters.MapPresenter2D.handleViewZoomToExtentsRequested(object sender = {SharpMap.Presentation.WinForms.MapViewControl}, System.EventArgs e = {System.EventArgs}) Line 1247 + 0x8 bytes    C#
     SharpMap.Presentation.WinForms.dll!SharpMap.Presentation.WinForms.MapViewControl.onRequestZoomToExtents() Line 1026 + 0x14 bytes    C#
     SharpMap.Presentation.WinForms.dll!SharpMap.Presentation.WinForms.MapViewControl.ZoomToExtents() Line 393 + 0x8 bytes    C#

 

Best regards Faxy

Coordinator
Nov 2, 2009 at 10:09 AM

Hi Faxy, you are trying to map an infinately small area.. add another point (or other geometry) hth jd

Nov 2, 2009 at 2:58 PM
Edited Nov 2, 2009 at 2:59 PM

Hi John,

Thank you for your reply.

I know that if i have 2 points everything is OK but in my situation i need only 1 point in 1 layer.

Is there a way to build layer with only one point or to create some extent to this layer and to put the point into it?

Best regards Faxy