Proper storage of a uniform, XYZ plane, in Postgres PostGIS

139 Views Asked by At

Problem Statement: Consider a gray scale image taken of a plane. Each pixel is an intensity value (Z). I have the position in physical space of the top left most pixel. I also have the offset of each X and Y pixel from left to right (X), and up to down (Y). Consider the image to be perfectly non-distorted, so the offset is uniform for every row.

I would like to store these image in a POSTGIS database in a way that allows the user to query a polygon from an image.

Current Implementation: Currently I believe I am doing something stupid, I create a Multipoint geometry and store each point with ( X Y Z ) using python. Since the image is uniform, I am repeating lots of data (x and y for each point), but this works when querying the database for a polygon, but is an excessive amount of extra data.

Question:

  1. What is the best way to store such data and allow the user to query a polygon from the image?
  2. Is PostGIS Geometry the correct datatype?
  3. Is the multipoint approach reasonable?
0

There are 0 best solutions below