コード例 #1
0
ファイル: test_io.py プロジェクト: reubano/meza
    def test_geojson_with_key(self):
        """Test for reading GeoJSON files with a key"""
        for filepath in self.filepaths:
            records = io.read_geojson(filepath)
            f = cv.records2geojson(records, key='id')
            geojson = loads(f.read())

            nt.assert_equal('FeatureCollection', geojson['type'])
            nt.assert_true('crs' in geojson)
            nt.assert_equal(self.bbox, geojson['bbox'])
            nt.assert_true(geojson['features'])

            for feature in geojson['features']:
                nt.assert_equal('Feature', feature['type'])
                nt.assert_true('id' in feature)
                nt.assert_less_equal(2, len(feature['properties']))

                geometry = feature['geometry']

                if geometry['type'] == 'Point':
                    nt.assert_equal(2, len(geometry['coordinates']))
                elif geometry['type'] == 'LineString':
                    nt.assert_equal(2, len(geometry['coordinates'][0]))
                elif geometry['type'] == 'Polygon':
                    nt.assert_equal(2, len(geometry['coordinates'][0][0]))
コード例 #2
0
    def test_geojson_with_key(self):
        """Test for reading GeoJSON files with a key"""
        for filepath in self.filepaths:
            records = io.read_geojson(filepath)
            f = cv.records2geojson(records, key="id")
            geojson = loads(f.read())

            nt.assert_equal("FeatureCollection", geojson["type"])
            nt.assert_true("crs" in geojson)
            nt.assert_equal(self.bbox, geojson["bbox"])
            nt.assert_true(geojson["features"])

            for feature in geojson["features"]:
                nt.assert_equal("Feature", feature["type"])
                nt.assert_true("id" in feature)
                nt.assert_less_equal(2, len(feature["properties"]))

                geometry = feature["geometry"]

                if geometry["type"] == "Point":
                    nt.assert_equal(2, len(geometry["coordinates"]))
                elif geometry["type"] == "LineString":
                    nt.assert_equal(2, len(geometry["coordinates"][0]))
                elif geometry["type"] == "Polygon":
                    nt.assert_equal(2, len(geometry["coordinates"][0][0]))
コード例 #3
0
    def test_geojson_with_key(self):
        """Test for reading GeoJSON files with a key"""
        for filepath in self.filepaths:
            records = io.read_geojson(filepath)
            f = cv.records2geojson(records, key='id')
            geojson = loads(f.read())

            nt.assert_equal('FeatureCollection', geojson['type'])
            nt.assert_true('crs' in geojson)
            nt.assert_equal(self.bbox, geojson['bbox'])
            nt.assert_true(geojson['features'])

            for feature in geojson['features']:
                nt.assert_equal('Feature', feature['type'])
                nt.assert_true('id' in feature)
                nt.assert_less_equal(2, len(feature['properties']))

                geometry = feature['geometry']

                if geometry['type'] == 'Point':
                    nt.assert_equal(2, len(geometry['coordinates']))
                elif geometry['type'] == 'LineString':
                    nt.assert_equal(2, len(geometry['coordinates'][0]))
                elif geometry['type'] == 'Polygon':
                    nt.assert_equal(2, len(geometry['coordinates'][0][0]))
コード例 #4
0
    def test_geojson_with_crs(self):
        records = io.read_geojson(self.filepath)
        f = cv.records2geojson(records, crs='EPSG:4269')
        geojson = loads(f.read())

        nt.assert_true('crs' in geojson)
        nt.assert_equal('name', geojson['crs']['type'])
        nt.assert_equal('EPSG:4269', geojson['crs']['properties']['name'])
コード例 #5
0
ファイル: test_io.py プロジェクト: randlet/meza
    def test_geojson_with_crs(self):
        records = io.read_geojson(self.filepath)
        f = cv.records2geojson(records, crs='EPSG:4269')
        geojson = loads(f.read())

        nt.assert_true('crs' in geojson)
        nt.assert_equal('name', geojson['crs']['type'])
        nt.assert_equal('EPSG:4269', geojson['crs']['properties']['name'])
コード例 #6
0
    def test_geojson_with_crs(self):
        """Test for reading GeoJSON files with CRS"""
        records = io.read_geojson(self.filepath)
        f = cv.records2geojson(records, crs="EPSG:4269")
        geojson = loads(f.read())

        nt.assert_true("crs" in geojson)
        nt.assert_equal("name", geojson["crs"]["type"])
        nt.assert_equal("EPSG:4269", geojson["crs"]["properties"]["name"])