/// <summary> /// 根据文件流创建shapefile /// </summary> /// <param name="shpFileStream"></param> /// <param name="shxFileStream"></param> /// <param name="dbfFileStream"></param> /// <param name="prjFileStream"></param> /// <returns></returns> public static FeatureSet CreateFeatureSet (Stream shpFileStream, Stream shxFileStream, Stream dbfFileStream, Stream prjFileStream = null) { using var dbfReader = new DbfReader(dbfFileStream); var shxIndexs = new ShxReader().ReadShx(shxFileStream); var recordNum = shxIndexs.Count; using var shpReader = new ShpReader(shpFileStream, shxIndexs); var fs = CreateFeatureSet(shpReader, dbfReader, recordNum); if (prjFileStream != null) { string prjWkt = ""; using (var sr = new StreamReader(prjFileStream, dbfReader.Encoding)) { prjWkt = sr.ReadToEnd(); } var proj = Crs.CreateFromWkt(prjWkt); fs.Crs = proj; } return(fs); }
private Polygon GetPolygon() { Polygon polygon = new Polygon( new[] { new LinearRing( new[] { new Position(20, 20), new Position(20, 21), new Position(21, 21), new Position(21, 20), new Position(22, 20) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "b", "c" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); return(polygon); }
public void TestMultiPolygonConstructors() { var multiPolygon = new MultiPolygon( new[] { new PolygonCoordinates( new[] { new LinearRing( new[] { new Position(20, 20), new Position(20, 21), new Position(21, 21), new Position(21, 20), new Position(22, 20) }) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); Assert.AreEqual(new Position(20, 20), multiPolygon.Polygons[0].Rings[0].Positions[0]); Assert.AreEqual(new Position(0, 0), multiPolygon.BoundingBox.Min); Assert.AreEqual(new Position(40, 40), multiPolygon.BoundingBox.Max); Assert.AreEqual("b", multiPolygon.AdditionalProperties["a"]); Assert.AreEqual("SomeCrs", ((NamedCrs)multiPolygon.Crs).Name); }
/// <summary> /// 从shapefile生成FeatureSet /// </summary> /// <param name="shpFilePath"></param> /// <returns></returns> public static FeatureSet CreateFeatureSet(string shpFilePath) { if (!ShpUtil.VerificationShp(shpFilePath, out var subFiles)) { throw new IOException("该shapefile文件不存在或者主文件缺失!"); } //else using var dbfReader = new DbfReader(subFiles.Item2); var shxIndexs = new ShxReader().ReadShx(subFiles.Item1); var recordNum = shxIndexs.Count; using var shpReader = new ShpReader(shpFilePath, shxIndexs); var fs = CreateFeatureSet(shpReader, dbfReader, recordNum); if (File.Exists(subFiles.Item3)) { string prjWkt = ""; using (var sr = new StreamReader(subFiles.Item3, Encoding.UTF8)) { prjWkt = sr.ReadToEnd(); } var proj = Crs.CreateFromWkt(prjWkt); fs.Crs = proj; } return(fs); }
public static async Task Run([TimerTrigger("0 */15 * * * *")] TimerInfo timer, ILogger log) { #if DEBUG log.LogInformation("Update traffic layer . . ."); #endif var trafficUrl = Environment.GetEnvironmentVariable(@"traffic.url"); #if DEBUG log.LogInformation($"Connecting to {trafficUrl}"); #endif var portalUrl = Environment.GetEnvironmentVariable(@"portal.url"); var appId = Environment.GetEnvironmentVariable(@"portal.appid"); var clientId = Environment.GetEnvironmentVariable(@"portal.clientid"); var featureService = Environment.GetEnvironmentVariable(@"portal.featureservice"); try { var roadFeatureCollection = await TrafficServiceInstance.Query(trafficUrl); var wgs84 = new Crs { Type = @"EPSG", Properties = new CrsProperties { Wkid = 4326 } }; roadFeatureCollection.CoordinateReferenceSystem = wgs84; var roadFeatures = roadFeatureCollection.ToFeatures(); using (var gateway = new PortalGateway(portalUrl, tokenProvider: new ArcGISOnlineAppLoginOAuthProvider(appId, clientId))) { #if DEBUG var info = await gateway.Info(); log.LogInformation($"Connecting to {info.FullVersion}"); #endif var featureServiceEndpoint = featureService.AsEndpoint(); var queryAllIds = new QueryForIds(featureServiceEndpoint); queryAllIds.Where = @"1=1"; var queryAllIdsResult = await gateway.QueryForIds(queryAllIds); var deleteAll = new ApplyEdits <IGeometry>(featureServiceEndpoint); deleteAll.Deletes.AddRange(queryAllIdsResult.ObjectIds); var deleteAllResult = await gateway.ApplyEdits(deleteAll); var addRoads = new ApplyEdits <IGeometry>(featureServiceEndpoint); foreach (var roadFeature in roadFeatures) { roadFeature.Geometry.SpatialReference = SpatialReference.WGS84; var serviceDateTime = (DateTime)roadFeature.Attributes[@"auswertezeit"]; roadFeature.Attributes[@"auswertezeit"] = DateTimeUtils.ConvertServiceTimeToUniversalTime(serviceDateTime); addRoads.Adds.Add(roadFeature); } var addRoadsResult = await gateway.ApplyEdits(addRoads); } } catch (Exception ex) { log.LogError(ex.Message); } }
public void NamedCrsEquals() { NamedCrs namedCrs1 = Crs.Named("AName"); NamedCrs namedCrs2 = Crs.Named("AName"); NamedCrs namedCrs3 = Crs.Named("AnotherName"); Assert.AreEqual(namedCrs1, namedCrs2); Assert.AreEqual(namedCrs1.GetHashCode(), namedCrs2.GetHashCode()); Assert.AreNotEqual(namedCrs1, namedCrs3); Assert.AreNotEqual(namedCrs1.GetHashCode(), namedCrs3.GetHashCode()); }
public void LinkedCrsConstructor() { LinkedCrs crs = Crs.Linked("http://foo.com"); Assert.AreEqual("http://foo.com", crs.Href); Assert.IsNull(crs.HrefType); crs = Crs.Linked("http://foo.com", "link"); Assert.AreEqual("http://foo.com", crs.Href); Assert.AreEqual("link", crs.HrefType); }
public void UnspecifiedCrsSerialization() { Crs crs = JsonConvert.DeserializeObject <Crs>(@"null"); Assert.AreEqual(CoordinateReferenceScheme.Unspecified, crs.Type); Assert.AreEqual(Crs.Unspecified, crs); string json = JsonConvert.SerializeObject(crs); Crs crs1 = JsonConvert.DeserializeObject <Crs>(json); Assert.AreEqual(crs1, crs); }
private Point GetPoint() { Point point = new Point( new Position(20, 30), new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); return(point); }
public static Offset <Crs> CreateCrs(FlatBufferBuilder builder, StringOffset orgOffset = default(StringOffset), int code = 0, StringOffset nameOffset = default(StringOffset), StringOffset descriptionOffset = default(StringOffset), StringOffset wktOffset = default(StringOffset)) { builder.StartObject(5); Crs.AddWkt(builder, wktOffset); Crs.AddDescription(builder, descriptionOffset); Crs.AddName(builder, nameOffset); Crs.AddCode(builder, code); Crs.AddOrg(builder, orgOffset); return(Crs.EndCrs(builder)); }
private LineString GetLineString() { LineString lineString = new LineString( new[] { new Position(20, 30), new Position(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); return(lineString); }
public void TestMultiPointConstructors() { var multiPoint = new MultiPoint( new[] { new Position(20, 30), new Position(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); Assert.AreEqual(new Position(20, 30), multiPoint.Points[0]); Assert.AreEqual(new Position(0, 0), multiPoint.BoundingBox.Min); Assert.AreEqual(new Position(40, 40), multiPoint.BoundingBox.Max); Assert.AreEqual("b", multiPoint.AdditionalProperties["a"]); Assert.AreEqual("SomeCrs", ((NamedCrs)multiPoint.Crs).Name); }
/// <summary> /// Writes the JSON representation of the object. /// </summary> /// <param name="writer">The <see cref="T:Newtonsoft.Json.JsonWriter" /> to write to.</param> /// <param name="value">The value.</param> /// <param name="serializer">The calling serializer.</param> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { Crs crs = (Crs)value; switch (crs.Type) { case CrsType.Linked: LinkedCrs linkedCrs = (LinkedCrs)crs; writer.WriteStartObject(); writer.WritePropertyName("type"); writer.WriteValue("link"); writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("href"); writer.WriteValue(linkedCrs.Href); if (linkedCrs.HrefType != null) { writer.WritePropertyName("type"); writer.WriteValue(linkedCrs.HrefType); } writer.WriteEndObject(); writer.WriteEndObject(); break; case CrsType.Named: NamedCrs namedCrs = (NamedCrs)crs; writer.WriteStartObject(); writer.WritePropertyName("type"); writer.WriteValue("name"); writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("name"); writer.WriteValue(namedCrs.Name); writer.WriteEndObject(); writer.WriteEndObject(); break; case CrsType.Unspecified: writer.WriteNull(); break; } }
public void LinkedCrsEquals() { LinkedCrs namedCrs1 = Crs.Linked("AName", "type"); LinkedCrs namedCrs2 = Crs.Linked("AName", "type"); LinkedCrs namedCrs3 = Crs.Linked("AnotherName", "type"); LinkedCrs namedCrs4 = Crs.Linked("AName", "anotherType"); LinkedCrs namedCrs5 = Crs.Linked("AName"); Assert.AreEqual(namedCrs1, namedCrs2); Assert.AreEqual(namedCrs1.GetHashCode(), namedCrs2.GetHashCode()); Assert.AreNotEqual(namedCrs1, namedCrs3); Assert.AreNotEqual(namedCrs1.GetHashCode(), namedCrs3.GetHashCode()); Assert.AreNotEqual(namedCrs1, namedCrs4); Assert.AreNotEqual(namedCrs1.GetHashCode(), namedCrs4.GetHashCode()); Assert.AreNotEqual(namedCrs1, namedCrs5); Assert.AreNotEqual(namedCrs1.GetHashCode(), namedCrs5.GetHashCode()); }
public void TestPointConstructors() { var point = new Point( new Position(20, 30), new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); Assert.AreEqual(20, point.Position.Longitude); Assert.AreEqual(30, point.Position.Latitude); Assert.AreEqual(new Position(0, 0), point.BoundingBox.Min); Assert.AreEqual(new Position(40, 40), point.BoundingBox.Max); Assert.AreEqual("b", point.AdditionalProperties["a"]); Assert.AreEqual("SomeCrs", ((NamedCrs)point.Crs).Name); }
public void TestGeometryCollectionConstructors() { var geometryCollection = new GeometryCollection( new[] { new Point(20, 30), new Point(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); Assert.AreEqual(new Point(20, 30), geometryCollection.Geometries[0]); Assert.AreEqual(new Point(30, 40), geometryCollection.Geometries[1]); Assert.AreEqual(new Position(0, 0), geometryCollection.BoundingBox.Min); Assert.AreEqual(new Position(40, 40), geometryCollection.BoundingBox.Max); Assert.AreEqual("b", geometryCollection.AdditionalProperties["a"]); Assert.AreEqual("SomeCrs", ((NamedCrs)geometryCollection.Crs).Name); }
public void TestLineStringConstructors() { var lineString = new LineString( new[] { new Position(20, 30), new Position(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); Assert.AreEqual(new Position(20, 30), lineString.Positions[0]); Assert.AreEqual(new Position(30, 40), lineString.Positions[1]); Assert.AreEqual(new Position(0, 0), lineString.BoundingBox.Min); Assert.AreEqual(new Position(40, 40), lineString.BoundingBox.Max); Assert.AreEqual("b", lineString.AdditionalProperties["a"]); Assert.AreEqual("SomeCrs", ((NamedCrs)lineString.Crs).Name); }
public void TestGeometryCollectionEqualsHashCode() { var geometryCollection1 = new GeometryCollection( new[] { new Point(20, 30), new Point(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var geometryCollection2 = new GeometryCollection( new[] { new Point(20, 30), new Point(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var geometryCollection3 = new GeometryCollection( new[] { new Point(20, 30), new Point(30, 41) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var geometryCollection4 = new GeometryCollection( new[] { new Point(20, 30), new Point(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "b", "c" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var geometryCollection5 = new GeometryCollection( new[] { new Point(20, 30), new Point(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 41)), Crs = Crs.Named("SomeCrs") }); var geometryCollection6 = new GeometryCollection( new[] { new Point(20, 30), new Point(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs1") }); Assert.AreEqual(geometryCollection1, geometryCollection2); Assert.AreEqual(geometryCollection1.GetHashCode(), geometryCollection2.GetHashCode()); Assert.AreNotEqual(geometryCollection1, geometryCollection3); Assert.AreNotEqual(geometryCollection1.GetHashCode(), geometryCollection3.GetHashCode()); Assert.AreNotEqual(geometryCollection1, geometryCollection4); Assert.AreNotEqual(geometryCollection1.GetHashCode(), geometryCollection4.GetHashCode()); Assert.AreNotEqual(geometryCollection1, geometryCollection5); Assert.AreNotEqual(geometryCollection1.GetHashCode(), geometryCollection5.GetHashCode()); Assert.AreNotEqual(geometryCollection1, geometryCollection6); Assert.AreNotEqual(geometryCollection1.GetHashCode(), geometryCollection6.GetHashCode()); }
public void NamedCrsConstructorException() { Crs.Named(null); }
public void NamedCrsConstructor() { NamedCrs namedCrs = Crs.Named("NamedCrs"); Assert.AreEqual("NamedCrs", namedCrs.Name); }
public void LinkedCrsConstructorException() { Crs.Linked(null); }
public void TestMultiLineStringEqualsHashCode() { var multiLineString1 = new MultiLineString( new[] { new LineStringCoordinates(new[] { new Position(20, 30), new Position(30, 40) }), new LineStringCoordinates(new[] { new Position(40, 50), new Position(60, 60) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var multiLineString2 = new MultiLineString( new[] { new LineStringCoordinates(new[] { new Position(20, 30), new Position(30, 40) }), new LineStringCoordinates(new[] { new Position(40, 50), new Position(60, 60) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var multiLineString3 = new MultiLineString( new[] { new LineStringCoordinates(new[] { new Position(20, 30), new Position(30, 41) }), new LineStringCoordinates(new[] { new Position(40, 50), new Position(60, 60) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var multiLineString4 = new MultiLineString( new[] { new LineStringCoordinates(new[] { new Position(20, 30), new Position(30, 40) }), new LineStringCoordinates(new[] { new Position(40, 50), new Position(60, 60) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "b", "c" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var multiLineString5 = new MultiLineString( new[] { new LineStringCoordinates(new[] { new Position(20, 30), new Position(30, 40) }), new LineStringCoordinates(new[] { new Position(40, 50), new Position(60, 60) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 41)), Crs = Crs.Named("SomeCrs") }); var multiLineString6 = new MultiLineString( new[] { new LineStringCoordinates(new[] { new Position(20, 30), new Position(30, 40) }), new LineStringCoordinates(new[] { new Position(40, 50), new Position(60, 60) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs1") }); Assert.AreEqual(multiLineString1, multiLineString2); Assert.AreEqual(multiLineString1.GetHashCode(), multiLineString2.GetHashCode()); Assert.AreNotEqual(multiLineString1, multiLineString3); Assert.AreNotEqual(multiLineString1.GetHashCode(), multiLineString3.GetHashCode()); Assert.AreNotEqual(multiLineString1, multiLineString4); Assert.AreNotEqual(multiLineString1.GetHashCode(), multiLineString4.GetHashCode()); Assert.AreNotEqual(multiLineString1, multiLineString5); Assert.AreNotEqual(multiLineString1.GetHashCode(), multiLineString5.GetHashCode()); Assert.AreNotEqual(multiLineString1, multiLineString6); Assert.AreNotEqual(multiLineString1.GetHashCode(), multiLineString6.GetHashCode()); }
public void TestMultiPointEqualsHashCode() { var multiPoint1 = new MultiPoint( new[] { new Position(20, 30), new Position(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var multiPoint2 = new MultiPoint( new[] { new Position(20, 30), new Position(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var multiPoint3 = new MultiPoint( new[] { new Position(20, 30), new Position(31, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var multiPoint4 = new MultiPoint( new[] { new Position(20, 30), new Position(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "b", "c" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var multiPoint5 = new MultiPoint( new[] { new Position(20, 30), new Position(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 41)), Crs = Crs.Named("SomeCrs") }); var multiPoint6 = new MultiPoint( new[] { new Position(20, 30), new Position(30, 40) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs1") }); Assert.AreEqual(multiPoint1, multiPoint2); Assert.AreEqual(multiPoint1.GetHashCode(), multiPoint2.GetHashCode()); Assert.AreNotEqual(multiPoint1, multiPoint3); Assert.AreNotEqual(multiPoint1.GetHashCode(), multiPoint3.GetHashCode()); Assert.AreNotEqual(multiPoint1, multiPoint4); Assert.AreNotEqual(multiPoint1.GetHashCode(), multiPoint4.GetHashCode()); Assert.AreNotEqual(multiPoint1, multiPoint5); Assert.AreNotEqual(multiPoint1.GetHashCode(), multiPoint5.GetHashCode()); Assert.AreNotEqual(multiPoint1, multiPoint6); Assert.AreNotEqual(multiPoint1.GetHashCode(), multiPoint6.GetHashCode()); }
public static Crs GetRootAsCrs(ByteBuffer _bb, Crs obj) { return(obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void TestMultiPolygonEqualsHashCode() { var multiPolygon1 = new MultiPolygon( new[] { new PolygonCoordinates( new[] { new LinearRing( new[] { new Position(20, 20), new Position(20, 21), new Position(21, 21), new Position(21, 20), new Position(22, 20) }) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var multiPolygon2 = new MultiPolygon( new[] { new PolygonCoordinates( new[] { new LinearRing( new[] { new Position(20, 20), new Position(20, 21), new Position(21, 21), new Position(21, 20), new Position(22, 20) }) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var polygon3 = new MultiPolygon( new[] { new PolygonCoordinates( new[] { new LinearRing( new[] { new Position(20, 21), new Position(20, 21), new Position(21, 21), new Position(21, 20), new Position(22, 20) }) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var polygon4 = new MultiPolygon( new[] { new PolygonCoordinates( new[] { new LinearRing( new[] { new Position(20, 20), new Position(20, 21), new Position(21, 21), new Position(21, 20), new Position(22, 20) }) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "b", "c" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs") }); var polygon5 = new MultiPolygon( new[] { new PolygonCoordinates( new[] { new LinearRing( new[] { new Position(20, 20), new Position(20, 21), new Position(21, 21), new Position(21, 20), new Position(22, 20) }) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 41)), Crs = Crs.Named("SomeCrs") }); var polygon6 = new MultiPolygon( new[] { new PolygonCoordinates( new[] { new LinearRing( new[] { new Position(20, 20), new Position(20, 21), new Position(21, 21), new Position(21, 20), new Position(22, 20) }) }) }, new GeometryParams { AdditionalProperties = new Dictionary <string, object> { { "a", "b" } }, BoundingBox = new BoundingBox(new Position(0, 0), new Position(40, 40)), Crs = Crs.Named("SomeCrs1") }); Assert.AreEqual(multiPolygon1, multiPolygon2); Assert.AreEqual(multiPolygon1.GetHashCode(), multiPolygon2.GetHashCode()); Assert.AreNotEqual(multiPolygon1, polygon3); Assert.AreNotEqual(multiPolygon1.GetHashCode(), polygon3.GetHashCode()); Assert.AreNotEqual(multiPolygon1, polygon4); Assert.AreNotEqual(multiPolygon1.GetHashCode(), polygon4.GetHashCode()); Assert.AreNotEqual(multiPolygon1, polygon5); Assert.AreNotEqual(multiPolygon1.GetHashCode(), polygon5.GetHashCode()); Assert.AreNotEqual(multiPolygon1, polygon6); Assert.AreNotEqual(multiPolygon1.GetHashCode(), polygon6.GetHashCode()); }