Giter Site home page Giter Site logo

Comments (3)

brendan-ward avatar brendan-ward commented on June 12, 2024

Unless I'm missing something about what you are trying to do here, it should be this:

    gdf = gpd.GeoDataFrame(
        [(v, shape(g)) for g, v in rasterio.features.shapes(layer)],
        columns=["value", "geometry"],
        crs=src.crs
    )

The shapes extracted from the GeoTIFF are in the same CRS as the GeoTIFF.

From your transform, your pixels are not integer in size, so even if you converted your shape coordinates to pixel offsets within the GeoTIFF (translating them so that they are based on the origin point of the raster from the transform rather than the origin point of the CRS), they wouldn't be integer values, so you'd still have a floating point precision problem in addition to needing to define a custom CRS. Seems best to just keep your coordinates in the original CRS.

Feature coordinates don't have a concept of transform as used within a raster, which is really just a way of storing the parameters needed to calculate the position within the coordinate space specified by the CRS of each pixel within the raster.

from geoparquet.

bretttully avatar bretttully commented on June 12, 2024

Perhaps I wasn't clear -- calling rasterio.features.shapes without specifying the transform kwarg means that the geometries are aligned to the pixels in the geotiff.
image

We can store these geometries into a regular parquet file with some metadata that describes the x, y, z, width, height of the original raster file. Downstream processing often doesn't care about the projection of the points (i.e. calculating intersections between features extracted from different layers), and so it is numerically nice if this is all performed in the same space of all values existing between 0, 2048.

However, it would also be nice if we could drag that parquet file into a tool like QGIS and have it land in the correct spot (like you can do with the geotiff, or a mapbox vector tile). For this, I guess we would need the transform just as the geotiff does.

Feature coordinates don't have a concept of transform as used within a raster, which is really just a way of storing the parameters needed to calculate the position within the coordinate space specified by the CRS of each pixel within the raster.

This probably answers my question... it is not something that is normally done.

from geoparquet.

kylebarron avatar kylebarron commented on June 12, 2024

You can store a per-row geotransform by storing an Arrow FixedSizeList with 6 float numbers per row.

from geoparquet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.