public void Parse_ParsesEmptyPoint() { string wkt = "point empty"; Point parsed = WktReader.Parse <Point>(wkt); this.CompareCoordinate(Coordinate.Empty, parsed.Position); }
public void Parse_ParsesEmptyMultiPolygon() { string wkt = "multipolygon empty"; MultiPolygon parsed = WktReader.Parse <MultiPolygon>(wkt); Assert.NotNull(parsed); Assert.Empty(parsed.Geometries); }
public void Parse_Parses3DMeasuredLineString() { string wkt = "linestring zm (-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5)"; LineString parsed = WktReader.Parse <LineString>(wkt); Assert.NotNull(parsed); this.CompareCoordinates(_coordinatesXYZM, parsed.Coordinates); }
public void Parse_Parses2DLineString() { string wkt = "linestring (-10.1 15.5, 20.2 -25.5, 30.3 35.5)"; LineString parsed = WktReader.Parse <LineString>(wkt); Assert.NotNull(parsed); this.CompareCoordinates(_coordinatesXY, parsed.Coordinates); }
public void Parse_ParsesEmptyLineString() { string wkt = "linestring empty"; LineString parsed = WktReader.Parse <LineString>(wkt); Assert.NotNull(parsed); Assert.Empty(parsed.Coordinates); }
public void Parse_ParsesEmptyGeometryCollection() { string wkt = "geometrycollection empty"; GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt); Assert.NotNull(parsed); Assert.Empty(parsed.Geometries); }
public void Parse_Parses3DMeasuredPoint() { string wkt = "point zm (-10.1 15.5 100.5 1000.5)"; Point parsed = WktReader.Parse <Point>(wkt); Assert.NotNull(parsed); this.CompareCoordinate(_coordinatesXYZM[0], parsed.Position); }
public void Parse_ParsesMultiPoint() { string wkt = "multipoint empty"; MultiPoint parsed = (MultiPoint)WktReader.Parse(wkt); Assert.NotNull(parsed); Assert.Empty(parsed.Geometries); }
public void Parse_ParsesPolygon() { string wkt = "polygon empty"; Polygon parsed = (Polygon)WktReader.Parse(wkt); Assert.NotNull(parsed); Assert.Empty(parsed.ExteriorRing); }
public void Parse_ParsesEmptyMultiLineString() { string wkt = "multilinestring empty"; MultiLineString parsed = WktReader.Parse <MultiLineString>(wkt); Assert.NotNull(parsed); Assert.Empty(parsed.Geometries); }
public void ParsePolygon_Parses3DMeasuredPolygonOnlyExteriorRing() { string wkt = "polygon zm ((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5))"; Polygon parsed = WktReader.Parse <Polygon>(wkt); Assert.NotNull(parsed); this.CompareCoordinates(_coordinatesXYZM, parsed.ExteriorRing); Assert.Empty(parsed.InteriorRings); }
public void ParsePolygon_ParsesEmptyPolygon() { string wkt = "polygon empty"; Polygon parsed = WktReader.Parse <Polygon>(wkt); Assert.NotNull(parsed); Assert.Empty(parsed.ExteriorRing); Assert.Empty(parsed.InteriorRings); }
public void Parse_Parses2DPoint() { string wkt = "point (-10.1 15.5)"; Point parsed = WktReader.Parse <Point>(wkt); Assert.False(parsed.Is3D); Assert.False(parsed.IsMeasured); this.CompareCoordinate(_coordinatesXY[0], parsed.Position); }
public void Parse_Parses3DGeometryCollectionWithPoint() { string wkt = "geometrycollection z (point z (-10.1 15.5 100.5))"; GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt); Assert.NotNull(parsed); Assert.Equal(1, parsed.Geometries.Count); this.CompareCoordinate(_coordinatesXYZ[0], ((Point)parsed.Geometries[0]).Position); }
public void IsInRing_ReturnsFalseIfPointIsOutsideRing() { string wktRing = "linestring (0 0, 2 0, 1 1, 1 2, 0 0)"; LineString ring = WktReader.Parse <LineString>(wktRing); Coordinate c = new Coordinate(3, 0); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.False(target.IsInRing(c, ring.Coordinates)); }
public void IsInRing_ReturnsFalseIfPointIsInRingAndCYCoordinateIsSameAsVertexYCoordinate() { string wktRing = "linestring (-1 -1, 1 -1, 1 0.5, 1 1, -1 1, -1 -1)"; LineString ring = WktReader.Parse <LineString>(wktRing); Coordinate c = new Coordinate(-2, 0.5); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.False(target.IsInRing(c, ring.Coordinates)); }
public void IsInRing_ReturnsTrueIfPointIsInSimpleRing() { string wktRing = "linestring (-1 -1, 1 -1, 1 1, -1 1, -1 -1)"; LineString ring = WktReader.Parse <LineString>(wktRing); Coordinate c = new Coordinate(0.5, 0.5); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.True(target.IsInRing(c, ring.Coordinates)); }
public void IsInRing_ReturnsTrueIfPointIsInConcaveRing() { string wktRing = "linestring (0 0, 2 0, 1 1, 1 2, 0 0)"; LineString ring = WktReader.Parse <LineString>(wktRing); Coordinate c = new Coordinate(1, 0.5); Euclidean2DLocator target = new Euclidean2DLocator(); Assert.True(target.IsInRing(c, ring.Coordinates)); }
public void Parse_Parses3DMeasuredGeometryCollectionWithPoint() { string wkt = "geometrycollection zm (point zm (-10.1 15.5 100.5 1000.5))"; GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt); Assert.NotNull(parsed); Assert.Single(parsed.Geometries); this.CompareCoordinate(_coordinatesXYZM[0], ((Point)parsed.Geometries[0]).Position); }
public void Parse_Parses3DMeasuredMultiPolygon() { string wkt = "multipolygon zm (((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5)),((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5)))"; MultiPolygon parsed = WktReader.Parse <MultiPolygon>(wkt); Assert.NotNull(parsed); Assert.Equal(2, parsed.Geometries.Count); this.CompareCoordinates(_coordinatesXYZM, parsed.Geometries[0].ExteriorRing); this.CompareCoordinates(_coordinatesXYZM, parsed.Geometries[1].ExteriorRing); }
public void Parse_Parses3DMeasuredMultiLineString() { string wkt = "multilinestring zm ((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5),(-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5))"; MultiLineString parsed = WktReader.Parse <MultiLineString>(wkt); Assert.NotNull(parsed); Assert.Equal(2, parsed.Geometries.Count); this.CompareCoordinates(_coordinatesXYZM, parsed.Geometries[0].Coordinates); this.CompareCoordinates(_coordinatesXYZM, parsed.Geometries[1].Coordinates); }
public void Parse_Parses3DMeasuredMultiPoint() { string wkt = "multipoint zm ((-10.1 15.5 100.5 1000.5),(20.2 -25.5 200.5 2000.5))"; MultiPoint parsed = WktReader.Parse <MultiPoint>(wkt); Assert.NotNull(parsed); Assert.Equal(2, parsed.Geometries.Count); this.CompareCoordinate(_coordinatesXYZM[0], parsed.Geometries[0].Position); this.CompareCoordinate(_coordinatesXYZM[1], parsed.Geometries[1].Position); }
public void Parse_ParsesNestedCollections() { string wkt = "geometrycollection (geometrycollection (point (-10.1 15.5)))"; GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt); Assert.NotNull(parsed); Assert.Single(parsed.Geometries); GeometryCollection <Geometry> nested = (GeometryCollection <Geometry>)parsed.Geometries[0]; this.CompareCoordinate(_coordinatesXY[0], ((Point)nested.Geometries[0]).Position); }
public void Parse_ParsesCollectionWithPointLineStringAndPolygon() { string wkt = "geometrycollection (point (-10.1 15.5),linestring (-10.1 15.5, 20.2 -25.5, 30.3 35.5),polygon ((-10.1 15.5, 20.2 -25.5, 30.3 35.5)))"; GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt); Assert.NotNull(parsed); Assert.Equal(3, parsed.Geometries.Count); this.CompareCoordinate(_coordinatesXY[0], ((Point)parsed.Geometries[0]).Position); this.CompareCoordinates(_coordinatesXY, ((LineString)parsed.Geometries[1]).Coordinates); this.CompareCoordinates(_coordinatesXY, ((Polygon)parsed.Geometries[2]).ExteriorRing); }
public void ParsePolygon_Parses3DMeasuredPolygonWithInteriorRings() { string wkt = "polygon zm ((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5),(-1.1 1.5 10.5 100.5, 2.2 -2.5 20.5 200.5, 3.3 3.5 -30.5 -300.5),(-1.1 1.5 10.5 100.5, 2.2 -2.5 20.5 200.5, 3.3 3.5 -30.5 -300.5))"; Polygon parsed = WktReader.Parse <Polygon>(wkt); Assert.NotNull(parsed); this.CompareCoordinates(_coordinatesXYZM, parsed.ExteriorRing); Assert.Equal(2, parsed.InteriorRings.Count); this.CompareCoordinates(_coordinates2XYZM, parsed.InteriorRings[0]); this.CompareCoordinates(_coordinates2XYZM, parsed.InteriorRings[1]); }
private Geometry ParseWKT(string wkt) { return(WktReader.Parse(wkt)); }
public void Parse_ThrowsExceptionIfWktDoNotRepresentGeometryCollection() { string wkt = "point empty"; Assert.Throws <WktParseException>(() => WktReader.Parse <GeometryCollection <Geometry> >(wkt)); }
public void Parse_ThrowsExceptionIfWktDoNotRepresentPoint() { string wkt = "linestring empty"; Assert.Throws <WktParseException>(() => WktReader.Parse <Point>(wkt)); }
public void Parse_ThrowsExceptionIfWktDoNotRepresentMultiPolygon() { string wkt = "point empty"; Assert.Throws <WktParseException>(() => WktReader.Parse <MultiPolygon>(wkt)); }
public void Parse_ThrowsExceptionIfWktDoNotRepresentLineString() { string wkt = "point empty"; Assert.Throws <WktParseException>(() => WktReader.Parse <LineString>(wkt)); }