예제 #1
0
 def setUp(self):
     nybb_filename, nybb_zip_path = download_nybb()
     vfs = 'zip://' + nybb_filename
     self.df = read_file(nybb_zip_path, vfs=vfs)
     with fiona.open(nybb_zip_path, vfs=vfs) as f:
         self.crs = f.crs
         self.columns = list(f.meta["schema"]["properties"].keys())
예제 #2
0
 def setUp(self):
     nybb_filename, nybb_zip_path = download_nybb()
     vfs = 'zip://' + nybb_filename
     self.df = read_file(nybb_zip_path, vfs=vfs)
     with fiona.open(nybb_zip_path, vfs=vfs) as f:
         self.crs = f.crs
         self.columns = list(f.meta["schema"]["properties"].keys())
예제 #3
0
    def setUp(self):
        N = 10

        nybb_filename, nybb_zip_path = download_nybb()

        self.polydf = read_file(nybb_zip_path, vfs='zip://' + nybb_filename)
        self.tempdir = tempfile.mkdtemp()
        self.crs = {'init': 'epsg:4326'}
        b = [int(x) for x in self.polydf.total_bounds]
        self.polydf2 = GeoDataFrame([{
            'geometry': Point(x, y).buffer(10000),
            'value1': x + y,
            'value2': x - y
        } for x, y in zip(range(b[0], b[2], int(
            (b[2] - b[0]) / N)), range(b[1], b[3], int((b[3] - b[1]) / N)))],
                                    crs=self.crs)
        self.pointdf = GeoDataFrame([{
            'geometry': Point(x, y),
            'value1': x + y,
            'value2': x - y
        } for x, y in zip(range(b[0], b[2], int(
            (b[2] - b[0]) / N)), range(b[1], b[3], int((b[3] - b[1]) / N)))],
                                    crs=self.crs)

        # TODO this appears to be necessary;
        # why is the sindex not generated automatically?
        self.polydf2._generate_sindex()

        self.union_shape = (180, 7)
예제 #4
0
 def test_filtered_read_file(self):
     full_df_shape = self.df.shape
     nybb_filename, nybb_zip_path = download_nybb()
     vfs = 'zip://' + nybb_filename
     bbox = (1031051.7879884212, 224272.49231459625, 1047224.3104931959, 244317.30894023244)
     filtered_df = read_file(nybb_zip_path, vfs=vfs, bbox=bbox)
     filtered_df_shape = filtered_df.shape
     assert(full_df_shape != filtered_df_shape)
     assert(filtered_df_shape == (2, 5))
예제 #5
0
    def test_from_features(self):
        nybb_filename, nybb_zip_path = download_nybb()
        with fiona.open(nybb_zip_path, vfs='zip://' + nybb_filename) as f:
            features = list(f)
            crs = f.crs

        df = GeoDataFrame.from_features(features, crs=crs)
        df.rename(columns=lambda x: x.lower(), inplace=True)
        validate_boro_df(self, df)
        self.assert_(df.crs == crs)
예제 #6
0
 def setUp(self):
     nybb_filename, nybb_zip_path = download_nybb()
     self.polydf = read_file(nybb_zip_path, vfs='zip://' + nybb_filename)
     self.tempdir = tempfile.mkdtemp()
     self.crs = self.polydf.crs
     N = 20
     b = [int(x) for x in self.polydf.total_bounds]
     self.pointdf = GeoDataFrame([
         {'geometry' : Point(x, y), 'pointattr1': x + y, 'pointattr2': x - y}
         for x, y in zip(range(b[0], b[2], int((b[2]-b[0])/N)),
                         range(b[1], b[3], int((b[3]-b[1])/N)))], crs=self.crs)
예제 #7
0
    def test_from_features(self):
        nybb_filename, nybb_zip_path = download_nybb()
        with fiona.open(nybb_zip_path,
                        vfs='zip://' + nybb_filename) as f:
            features = list(f)
            crs = f.crs

        df = GeoDataFrame.from_features(features, crs=crs)
        df.rename(columns=lambda x: x.lower(), inplace=True)
        validate_boro_df(self, df)
        self.assert_(df.crs == crs)
예제 #8
0
 def setUp(self):
     nybb_filename, nybb_zip_path = download_nybb()
     self.polydf = read_file(nybb_zip_path, vfs='zip://' + nybb_filename)
     self.tempdir = tempfile.mkdtemp()
     self.crs = self.polydf.crs
     N = 20
     b = [int(x) for x in self.polydf.total_bounds]
     self.pointdf = GeoDataFrame([{
         'geometry': Point(x, y),
         'pointattr1': x + y,
         'pointattr2': x - y
     } for x, y in zip(range(b[0], b[2], int(
         (b[2] - b[0]) / N)), range(b[1], b[3], int((b[3] - b[1]) / N)))],
                                 crs=self.crs)
예제 #9
0
    def setUp(self):
        N = 10

        nybb_filename, nybb_zip_path = download_nybb()

        self.df = read_file(nybb_zip_path, vfs='zip://' + nybb_filename)
        with fiona.open(nybb_zip_path, vfs='zip://' + nybb_filename) as f:
            self.schema = f.schema
        self.tempdir = tempfile.mkdtemp()
        self.boros = self.df['BoroName']
        self.crs = {'init': 'epsg:4326'}
        self.df2 = GeoDataFrame([
            {'geometry': Point(x, y), 'value1': x + y, 'value2': x * y}
            for x, y in zip(range(N), range(N))], crs=self.crs)
        self.df3 = read_file(os.path.join(PACKAGE_DIR, 'examples', 'null_geom.geojson'))
        self.line_paths = self.df3['Name']
예제 #10
0
    def setUp(self):
        N = 10

        nybb_filename, nybb_zip_path = download_nybb()

        self.df = read_file(nybb_zip_path, vfs='zip://' + nybb_filename)
        with fiona.open(nybb_zip_path, vfs='zip://' + nybb_filename) as f:
            self.schema = f.schema
        self.tempdir = tempfile.mkdtemp()
        self.boros = self.df['BoroName']
        self.crs = {'init': 'epsg:4326'}
        self.df2 = GeoDataFrame([{
            'geometry': Point(x, y),
            'value1': x + y,
            'value2': x * y
        } for x, y in zip(range(N), range(N))],
                                crs=self.crs)
        self.df3 = read_file(
            os.path.join(PACKAGE_DIR, 'examples', 'null_geom.geojson'))
        self.line_paths = self.df3['Name']
예제 #11
0
    def setUp(self):
        N = 10

        nybb_filename, nybb_zip_path = download_nybb()

        self.polydf = read_file(nybb_zip_path, vfs='zip://' + nybb_filename)
        self.tempdir = tempfile.mkdtemp()
        self.crs = {'init': 'epsg:4326'}
        b = [int(x) for x in self.polydf.total_bounds]
        self.polydf2 = GeoDataFrame([
            {'geometry' : Point(x, y).buffer(10000), 'value1': x + y, 'value2': x - y}
            for x, y in zip(range(b[0], b[2], int((b[2]-b[0])/N)),
                            range(b[1], b[3], int((b[3]-b[1])/N)))], crs=self.crs)
        self.pointdf = GeoDataFrame([
            {'geometry' : Point(x, y), 'value1': x + y, 'value2': x - y}
            for x, y in zip(range(b[0], b[2], int((b[2]-b[0])/N)),
                            range(b[1], b[3], int((b[3]-b[1])/N)))], crs=self.crs)

        # TODO this appears to be necessary;
        # why is the sindex not generated automatically?
        self.polydf2._generate_sindex()

        self.union_shape = (180, 7)
예제 #12
0
 def setUp(self):
     nybb_filename, nybb_zip_path = download_nybb()
     self.boros = read_file(nybb_zip_path, vfs='zip://' + nybb_filename)
예제 #13
0
 def setUp(self):
     nybb_filename, nybb_zip_path = download_nybb()
     vfs = 'zip://' + nybb_filename
     self.df = read_file(nybb_zip_path, vfs=vfs)
     with fiona.open(nybb_zip_path, vfs=vfs) as f:
         self.crs = f.crs