Re: Storing data on a regular lat/lon grid

From: Mike Charles <gamemusicmaker(at)gmail(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Storing data on a regular lat/lon grid
Date: 2010-04-14 21:47:26
Message-ID: m2nbced44b41004141447y7ee6c2c1i54aaccf7ff7c5ca7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2010-04-14 22:09:55 Re: Unique cosntraint based on contents of a field?
Previous Message Damian Carey 2010-04-14 20:41:05 Re: pl/java status