Exemplo n.º 1
0
 def test_sql_subset(self):
     sc = GeomCabinet()
     path = sc.get_shp_path('state_boundaries')
     ds = ogr.Open(path)
     ret = ds.ExecuteSQL('select * from state_boundaries where state_name = "New Jersey"')
     ret.ResetReading()
     self.assertEqual(len(ret), 1)
Exemplo n.º 2
0
    def test_number_in_shapefile_name(self):
        """Test number in shapefile name."""

        sc = GeomCabinet()
        path = sc.get_shp_path('state_boundaries')
        out_path = os.path.join(self.current_dir_output, '51_states.shp')
        with fiona.open(path) as source:
            with fiona.open(out_path, mode='w', driver='ESRI Shapefile', schema=source.meta['schema'],
                            crs=source.meta['crs']) as sink:
                for record in source:
                    sink.write(record)
        ret = list(GeomCabinetIterator(select_uid=[23], path=out_path))
        self.assertEqual(len(ret), 1)