Beispiel #1
0
def test_gpd_to_values_no_geom():

    data = gpd.GeoDataFrame(pd.np.arange(3), columns=['param'])
    with pytest.warns(UserWarning,
                      match="GeoDataFrame has no geometry to display."):
        for a, b in zip(json.loads(gpdvega.gpd_to_values(data)['values']),
                        data.param.tolist()):
            assert a['param'] == b
Beispiel #2
0
def test_gpd_to_values():

    data = _create_geojson()
    for a, b in zip(
            json.loads(gpdvega.gpd_to_values(geojson2gdp(data))['values']),
            data['features']):
        assert a['id'] == b['id']
        assert a['prop'] == b['properties']['prop']
        assert a['geometry'] == b['geometry']
Beispiel #3
0
def test_gpd_to_values_warnings():
    data = geojson2gdp(_create_geojson())
    with pytest.warns(UserWarning, match="Column name 'type'"):
        gpdvega.gpd_to_values(data.assign(type='type'))
    with pytest.warns(UserWarning, match="Column name 'id'"):
        gpdvega.gpd_to_values(data.assign(id='id'))
    with pytest.warns(UserWarning, match="Column name 'geometry'"):
        gpdvega.gpd_to_values(
            data.rename(columns={
                'geometry': 'g'
            }).set_geometry('g').assign(geometry='xxx'))
Beispiel #4
0
def test_gpd_to_values_pd():
    data = pd.DataFrame(pd.np.arange(3), columns=['param'])
    assert gpdvega.gpd_to_values(data) == alt.to_values(data)