[postgis-users] Postgis Spatial Interpolation
Chris Hermansen
chris.hermansen at timberline.ca
Tue Mar 3 09:41:51 PST 2009
A circular buffer would return the four nearest neighbours. By
inspecting the coordinates you can determine which one is the eastern,
southern, western, and northern neighbour respectively. With the
coordinates and attributes of the neighbours you can interpolate your
points and values against some kind of kernel.
You would probably do this inside a stored procedure which would take
the coordinates of the point to be interpolated and return the
interpolated value(s). Alternatively you could do it in a programming
language that has an interface to PostgreSQL / PostGIS, if that better
suits your needs.
A side question: can weather data really be reliably interpolated at
this scale?
Jan Hartmann wrote:
> There is a second solution, PL/R: the complete R system embedded in a
> PostgreSQL server, exactly the other way round from RGdal. On Unix you
> have to compile it with PostgreSQL, about the same way as you include
> PostGIS. There are Windows executables for PostgreSQL with PostGIS and
> PostgreSQL with PL/R, but not a complete combined system, I believe,
> although that should not be difficult to produce. I do not know what
> is easier, working in the R environment and doing GIS with RGDAL, or
> working in PostGIS and doing statistics with PL/R. Probably both. I
> have done some work with PL/R, and I have been flabbergasterd (is that
> English?) with the power of such a combined system. Problem is, I just
> haven't enough time to really explore it. You need to know a little
> about many things: SQL, R, MapScript, a bit of JavaScript, and so
> forth, all quite complex languages, more complex than they look at
> first sight. I *do* know a little about all that, but then you need
> the time and concentration to actually do something useful with it. I
> don't think there is anyone near me here in Amsterdam who knows even
> as little as me, so Regina's page will really help me, there should be
> more of them (Regina's, I mean).
>
> Anyway, give it a try (www.joeconway.com). Joe is one of the leading
> PostgreSQL developers, certainly on a par with Steve, Frank, Daniel
> and Paul, and equally courteous and helpful as they always have been
> on his mailing list. I was surprised to see how small the code is,
> with which he linked those two massive Open Source packages. That
> alone is a triumph of Open Source.
>
> Greetings from a cloudy Amsterdam (but spring is near).
>
> Jan
>
> Paragon Corporation wrote:
>> I'm not sure if the RGDAL package would help you.
>>
>> Here is a bit about it
>>
>> http://www.bostongis.com/PrinterFriendly.aspx?content_name=postgresql_plr_tut03
>>
>> I have a somewhat complex example that reads data from tiff files and
>> inserts into the database. Though work on the WKT Raster project may
>> be right up your alley.
>> http://postgis.refractions.net/support/wiki/index.php?WKTRasterHomePage
>>
>>
>> Hope that helps,
>> Regina
>>
>> ------------------------------------------------------------------------
>> *From:* postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net] *On Behalf Of
>> *Greg King
>> *Sent:* Monday, March 02, 2009 5:06 PM
>> *To:* postgis-users at postgis.refractions.net
>> *Subject:* [postgis-users] Postgis Spatial Interpolation
>>
>> Hi,
>>
>> I'm fairly new to postgis and spatial databases but have been very
>> pleased with the results I'm getting from postgis to date. One of my
>> projects is using postgis to load weather data from a 0.5 x 0.5
>> degree lat/long grid. I'm looking to interpolate data values that
>> fall between that grid point I have values for. A bit of googling
>> has revealed a number of applications that interface to postgis and
>> can do what I need (eg GRASS), but I don't need their full
>> functionality or the overhead of interfacing with them. My project
>> needs simply to return interpolated values to a web page and I would
>> rather just have a pl/pgsql procedure that gives me interpolated
>> values for a given point. My initial thoughts are to feed the
>> necessary point data from my database into a custom pl/R function and
>> get R to interpolate the data for my point. However, that is going
>> to involve a fair amount of custom code and for me to learn more
>> about R. I don't want to reinvent the wheel, so I'd be grateful for
>> any thoughts on solutions that meet my needs?
>>
>> Thanks,
>>
>> G
>>
>> PS In my googling I also saw references to PGRaster, but it looks
>> like that's still under consideration for development in postgis?
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
--
Regards,
Chris Hermansen mailto:chris.hermansen at timberline.ca
tel+1.604.714.2878 · fax+1.604.733.0631 · mob+1.778.232.0644
Timberline Natural Resource Group · http://www.timberline.ca
401 · 958 West 8th Avenue · Vancouver BC · Canada · V5Z 1E5
More information about the postgis-users
mailing list