Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raster_to_vector produces a geojson file with the wrong crs #886

Open
JeroenVerstraelen opened this issue Sep 30, 2024 · 0 comments
Open
Assignees

Comments

@JeroenVerstraelen
Copy link
Contributor

Example:

import openeo
from openeo.rest.datacube import DataCube
from openeo.rest.datacube import UDF

connection = openeo.connect("openeo-dev.vito.be").authenticate_oidc()
bbox = [5.0, 51.2, 5.1, 51.3]
temp_ext = ["2023-01-01", "2023-01-20"]

s2_bands = connection.load_collection(
    "SENTINEL2_L2A", spatial_extent=dict(zip(["west", "south", "east", "north"], bbox)), temporal_extent=temp_ext, bands=["SCL"]
)

scl_band = s2_bands.band("SCL")
s2_cloudmask = ( (scl_band == 1) ) * 1.0

vector = s2_cloudmask.raster_to_vector()
vector.download("s2_cloudmask.geojson", format="geojson")

Output:

{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "2023-01-02T00:00:00Z~band0": null, "2023-01-05T00:00:00Z~band0": null, "2023-01-07T00:00:00Z~band0": null, "2023-01-10T00:00:00Z~band0": null, "2023-01-15T00:00:00Z~band0": 0.0, "2023-01-17T00:00:00Z~band0": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 639420.0, 5685300.0 ], [ 639420.0, 5673960.0 ], [ 646720.0, 5673960.0 ], [ 646720.0, 5685300.0 ], [ 639420.0, 5685300.0 ] ] ] } },
{ "type": "Feature", "properties": { "2023-01-02T00:00:00Z~band0": null, "2023-01-05T00:00:00Z~band0": 0.0, "2023-01-07T00:00:00Z~band0": null, "2023-01-10T00:00:00Z~band0": null, "2023-01-15T00:00:00Z~band0": null, "2023-01-17T00:00:00Z~band0": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 639420.0, 5685300.0 ], [ 639420.0, 5673960.0 ], [ 646720.0, 5673960.0 ], [ 646720.0, 5685300.0 ], [ 639420.0, 5685300.0 ] ] ] } },
{ "type": "Feature", "properties": { "2023-01-02T00:00:00Z~band0": null, "2023-01-05T00:00:00Z~band0": null, "2023-01-07T00:00:00Z~band0": null, "2023-01-10T00:00:00Z~band0": null, "2023-01-15T00:00:00Z~band0": null, "2023-01-17T00:00:00Z~band0": 0.0 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 639420.0, 5685300.0 ], [ 639420.0, 5673960.0 ], [ 646720.0, 5673960.0 ], [ 646720.0, 5685300.0 ], [ 639420.0, 5685300.0 ] ] ] } },
{ "type": "Feature", "properties": { "2023-01-02T00:00:00Z~band0": 0.0, "2023-01-05T00:00:00Z~band0": null, "2023-01-07T00:00:00Z~band0": null, "2023-01-10T00:00:00Z~band0": null, "2023-01-15T00:00:00Z~band0": null, "2023-01-17T00:00:00Z~band0": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 639420.0, 5685300.0 ], [ 639420.0, 5673960.0 ], [ 646720.0, 5673960.0 ], [ 646720.0, 5685300.0 ], [ 639420.0, 5685300.0 ] ] ] } },
{ "type": "Feature", "properties": { "2023-01-02T00:00:00Z~band0": null, "2023-01-05T00:00:00Z~band0": null, "2023-01-07T00:00:00Z~band0": null, "2023-01-10T00:00:00Z~band0": 0.0, "2023-01-15T00:00:00Z~band0": null, "2023-01-17T00:00:00Z~band0": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 639420.0, 5685300.0 ], [ 639420.0, 5673960.0 ], [ 646720.0, 5673960.0 ], [ 646720.0, 5685300.0 ], [ 639420.0, 5685300.0 ] ] ] } },
{ "type": "Feature", "properties": { "2023-01-02T00:00:00Z~band0": null, "2023-01-05T00:00:00Z~band0": null, "2023-01-07T00:00:00Z~band0": 0.0, "2023-01-10T00:00:00Z~band0": null, "2023-01-15T00:00:00Z~band0": null, "2023-01-17T00:00:00Z~band0": null }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 639420.0, 5685300.0 ], [ 639420.0, 5673960.0 ], [ 646720.0, 5673960.0 ], [ 646720.0, 5685300.0 ], [ 639420.0, 5685300.0 ] ] ] } }
]
}

The features are in 32632 projection, but the FeatureCollection has CRS84 as crs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants