Обсуждение: Storing data on a regular lat/lon grid

Поиск
Список
Период
Сортировка

Storing data on a regular lat/lon grid

От
Mike Charles
Дата:
Hi all,

I have temperature data that has been interpolated to a regular lat/lon grid. I have one grid per day.

I want to be able to select points within a certain region, and within a certain time period.

Now, I could store each grid point as a separate record (a new row for every single point/time, with columns lat, lon, time, temperature), but since my grid is constant, there's a lot of redundancy there, no? Disk space is somewhat of a constraint, since there are a lot of files.

Basically, has anyone done any work with storing gridded spatial data? I see lot's of info on Geospatial data, but it's usually cities, stations, etc., not a regular grid that doesn't change...

I also noticed that PostGIS does not support raster data...

Thanks a lot,

--
Mike

Re: Storing data on a regular lat/lon grid

От
Merlin Moncure
Дата:
On Fri, Mar 26, 2010 at 3:25 PM, Mike Charles <gamemusicmaker@gmail.com> wrote:
> Hi all,
>
> I have temperature data that has been interpolated to a regular lat/lon
> grid. I have one grid per day.
>
> I want to be able to select points within a certain region, and within a
> certain time period.
>
> Now, I could store each grid point as a separate record (a new row for every
> single point/time, with columns lat, lon, time, temperature), but since my
> grid is constant, there's a lot of redundancy there, no? Disk space is
> somewhat of a constraint, since there are a lot of files.
>
> Basically, has anyone done any work with storing gridded spatial data? I see
> lot's of info on Geospatial data, but it's usually cities, stations, etc.,
> not a regular grid that doesn't change...

well, you could play around with storing information in arrays.
storing record for each point gives you the most flexibility of
querying and indexing but is extremely inefficient from storage
perspective.   arrays are better from that point of view and can work
pretty well as long as you read/write the data in blocks in a fairly
regular way (and hopefully the layout of your grid doesn't change that
often).

merlin

Re: Storing data on a regular lat/lon grid

От
Mike Charles
Дата:
Basically, has anyone done any work with storing gridded spatial data? I see
lot's of info on Geospatial data, but it's usually cities, stations, etc.,
not a regular grid that doesn't change...

well, you could play around with storing information in arrays.
storing record for each point gives you the most flexibility of
querying and indexing but is extremely inefficient from storage
perspective.   arrays are better from that point of view and can work
pretty well as long as you read/write the data in blocks in a fairly
regular way (and hopefully the layout of your grid doesn't change that
often).

Thanks for your help, I've stored a 2-dimensional array in Postgres, inserted like this:

{{1,1,3},{2,2,1},{3,1,2}}

But I'm having trouble retrieving it from Java. My jdbc driver is loaded fine and I'm connecting to the database, but I don't know how to get from a java.sql Array to an int[] array in Java. I'm using this piece of code to pull the data from the ResultSet:

Array categoryArray = rs.getArray("category").getArray();

But I don't know what to do with this. I want to end up with an int[] array. Can anyone suggest something?

Thanks a lot,

--
Mike