Skip to content

Geometry handling

The Polygon geometry parameter required for some UP42 operations like placing an image order, can be provided in multiple formats in the Python SDK. It is automatically transformed to the required formatting. Also see AOI guidelines.

You can also use up42.read_vector_file() to read local geojson, shapefiles, kml & wkt files.

{
    "coordinates": [
        [
            [
                13.382853541948975,
                52.5185756711692
            ],
            [
                13.382853541948975,
                52.512321097987126
            ],
            [
                13.39586259650261,
                52.512321097987126
            ],
            [
                13.39586259650261,
                52.5185756711692
            ],
            [
                13.382853541948975,
                52.5185756711692
            ]
        ]
    ],
    "type": "Polygon"
}
{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "properties": {},
            "geometry": {
                "coordinates": [
                    [
                        [
                            13.382853541948975,
                            52.5185756711692
                        ],
                        [
                            13.382853541948975,
                            52.512321097987126
                        ],
                        [
                            13.39586259650261,
                            52.512321097987126
                        ],
                        [
                            13.39586259650261,
                            52.5185756711692
                        ],
                        [
                            13.382853541948975,
                            52.5185756711692
                        ]
                    ]
                ],
                "type": "Polygon"
            }
        }
    ]
}
    {
    "type": "Feature",
    "properties": {},
    "geometry": {
        "coordinates": [
            [
                [
                    13.382853541948975,
                    52.5185756711692
                ],
                [
                    13.382853541948975,
                    52.512321097987126
                ],
                [
                    13.39586259650261,
                    52.512321097987126
                ],
                [
                    13.39586259650261,
                    52.5185756711692
                ],
                [
                    13.382853541948975,
                    52.5185756711692
                ]
            ]
        ],
        "type": "Polygon"
    }
}

The minx, miny, maxx, maxy bbox outline / bounds coordinates of a geometry.

aoi = [13.382853541948975, 52.512321097987126, 13.39586259650261, 52.5185756711692]

See the geopandas documentation.

The geopandas dataframe can only have a single row, and requires a Polygon geometry.

aoi = geopandas.read_file("aoi.geojson")

See the shapely documentation.

aoi = Polygon([(0, 0, 0), (0, 0, 1), (1, 1, 1)])