def testRemoveFeature(self): repo = self.getClonedRepo() repo.removefeatures(["parks/1"]) f = Feature(repo, geogit.WORK_HEAD, "parks/1") self.assertFalse(f.exists()) f = Feature(repo, geogit.STAGE_HEAD, "parks/1") self.assertFalse(f.exists())
def testOsmImport(self): repoPath = self.getTempRepoPath() repo = Repository(repoPath, init = True) osmfile = os.path.join(os.path.dirname(__file__), "data", "osm", "ways.xml") repo.importosm(osmfile) feature = Feature(repo, geogit.WORK_HEAD, "way/31045880") self.assertTrue(feature.exists())
def testOsmImportWithMappingFile(self): repoPath = self.getTempRepoPath() repo = Repository(repoPath, init = True) osmfile = os.path.join(os.path.dirname(__file__), "data", "osm", "ways.xml") mappingfile = os.path.join(os.path.dirname(__file__), "data", "osm", "mapping.json") repo.importosm(osmfile, False, mappingfile) feature = Feature(repo, geogit.WORK_HEAD, "onewaystreets/31045880") self.assertTrue(feature.exists())
def testOsmImportWithMapping(self): mapping = OSMMapping() rule = OSMMappingRule("onewaystreets") rule.addfilter("oneway", "yes") rule.addfield("lit", "lit", geogit.TYPE_STRING) rule.addfield("geom", "the_geom", geogit.TYPE_LINESTRING) mapping.addrule(rule) repoPath = self.getTempRepoPath() repo = Repository(repoPath, init = True) osmfile = os.path.join(os.path.dirname(__file__), "data", "osm", "ways.xml") repo.importosm(osmfile, False, mapping) feature = Feature(repo, geogit.WORK_HEAD, "onewaystreets/31045880") self.assertTrue(feature.exists())
def testExists(self): feature = Feature(self.repo, geogit.HEAD, "parks/1") self.assertTrue(feature.exists()) feature = Feature(self.repo, geogit.HEAD, "wrong/path") self.assertFalse(feature.exists())