public void Load_ThrowsExceptionIfAllRelationReferencesAreNotResolvedAtTheEndOfLoadingAndIgnoreMissingIsFalse() { IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_relation_invalid_ref), new OsmXmlReaderSettings() { ReadMetadata = true }); Assert.Throws <ArgumentException>(() => OsmGeometryDatabase.Load(reader, false)); }
static void TestOsmGeometryDatabaseLoadFromPbfReader() { using (PbfReader reader = new PbfReader("TestFiles\\test-file-dc.pbf", new OsmReaderSettings() { ReadMetadata = true })) { OsmGeometryDatabase db = OsmGeometryDatabase.Load(reader, true); } }
public void Load_ThrowsExceptionIfAllRelationReferencesAreNotResolvedAtTheEndOfLoadingAndIgnoreMissingIsFalse() { IOsmReader reader = new OsmXmlReader(TestDataReader.OpenOsmDB("osm-relation-invalid-ref.osm"), new OsmXmlReaderSettings() { ReadMetadata = true }); Assert.Throws <ArgumentException>(() => OsmGeometryDatabase.Load(reader, false)); }
public void OsmGeometryDatabase_LoadesRealFile() { OsmXmlReader reader = new OsmXmlReader(TestDataReader.OpenXml("osm-real-file.osm"), new OsmXmlReaderSettings() { ReadMetadata = true }); OsmGeometryDatabase target = OsmGeometryDatabase.Load(reader, true); Assert.Equal(6688, target.Nodes.Count); Assert.Equal(740, target.Ways.Count); Assert.Equal(75, target.Relations.Count); }
public void Load_DoesNotThrowExceptionIfIgnoreMissingIsTrueAndRelationMemberIsMissing() { IOsmReader reader = new OsmXmlReader(TestDataReader.OpenOsmDB("osm-relation-invalid-ref.osm"), new OsmXmlReaderSettings() { ReadMetadata = true }); OsmGeometryDatabase target = null; target = OsmGeometryDatabase.Load(reader, true); Assert.Equal(1, target.Relations.Count); }
public void Load_LoadedRealFile() { OsmXmlReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_real_file), new OsmXmlReaderSettings() { ReadMetadata = true }); OsmGeometryDatabase target = OsmGeometryDatabase.Load(reader, true); Assert.Equal(6688, target.Nodes.Count); Assert.Equal(740, target.Ways.Count); Assert.Equal(75, target.Relations.Count); }
public void Load_DoesNotThrowExceptionIfIgnoreMissingIsTrueAndRelationMemberIsMissing() { IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_relation_invalid_ref), new OsmXmlReaderSettings() { ReadMetadata = true }); OsmGeometryDatabase target = null; Assert.DoesNotThrow(() => target = OsmGeometryDatabase.Load(reader, true)); Assert.Equal(1, target.Relations.Count); }
public void Load_LoadsNodes() { IOsmReader reader = new OsmXmlReader(TestDataReader.OpenOsmDB("osm-nodes.osm"), new OsmXmlReaderSettings() { ReadMetadata = true }); OsmGeometryDatabase target = OsmGeometryDatabase.Load(reader, true); Assert.Equal(3, target.Nodes.Count); Assert.True(target.Nodes.Contains(1)); Assert.True(target.Nodes.Contains(2)); Assert.True(target.Nodes.Contains(3)); }
public void Load_LoadsNodes() { IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_nodes), new OsmXmlReaderSettings() { ReadMetadata = true }); OsmGeometryDatabase target = OsmGeometryDatabase.Load(reader, true); Assert.Equal(3, target.Nodes.Count); Assert.True(target.Nodes.Contains(1)); Assert.True(target.Nodes.Contains(2)); Assert.True(target.Nodes.Contains(3)); }
public void Load_CanLoadRelationsWithReferenceToRelationsNotYetCreated() { IOsmReader reader = new OsmXmlReader(TestDataReader.OpenOsmDB("osm-relation-ref-other-relation.osm"), new OsmXmlReaderSettings() { ReadMetadata = true }); OsmGeometryDatabase target = OsmGeometryDatabase.Load(reader, true); Assert.Equal(2, target.Relations.Count); Assert.True(target.Relations.Contains(100)); Assert.True(target.Relations.Contains(101)); Assert.Equal(101, target.Relations[100].Geometries[0].Member.ID); }
public void Load_CanLoadRelationsWithReferenceToRelationsNotYetCreated() { IOsmReader reader = new OsmXmlReader(new MemoryStream(OsmDatabaseTestData.osm_relation_ref_other_relation), new OsmXmlReaderSettings() { ReadMetadata = true }); OsmGeometryDatabase target = OsmGeometryDatabase.Load(reader, true); Assert.Equal(2, target.Relations.Count); Assert.True(target.Relations.Contains(100)); Assert.True(target.Relations.Contains(101)); Assert.Equal(101, target.Relations[100].Geometries[0].Member.ID); }