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));
        }
Пример #2
0
 static void TestOsmGeometryDatabaseLoadFromPbfReader()
 {
     using (PbfReader reader = new PbfReader("TestFiles\\test-file-dc.pbf", new OsmReaderSettings()
     {
         ReadMetadata = true
     })) {
         OsmGeometryDatabase db = OsmGeometryDatabase.Load(reader, true);
     }
 }
Пример #3
0
        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));
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #8
0
        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));
        }
Пример #10
0
        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);
        }