[postgis-users] Postgresql, postgis and PHP

Paragon Corporation lr at pcorp.us
Thu Feb 3 07:36:36 PST 2011


LJ,

The first chapter is a free download.  We took Paolo Coriti's advice (hmm I
think others suggested it to),and made the first chapter very quick paced.
So it covers, geometry, geography types, how to load and how to do common
spatial joins with it.

You might want to check that out.

It's changed quite a bit from the one that is currently posted on the site,
but I think most of the pieces are there.

http://www.manning.com/obe/PostGIS_MEAPCH01.pdf

Also all the code snippets and most of the data for the chapters are
available on our book site  and we don't require you to buy the book to
download them.  Though it helps since the book is more descriptive of what
is going on in the code. Just click on the paper clip to download the code
and accompanying data  for each chapter (the link is also available on each
chapter description page)

http://www.postgis.us/chapters


There are also some good examples and walk thru tutorials on the PostGIS
users site

http://trac.osgeo.org/postgis/wiki/UsersWikiTutorials





Hope that helps,
Leo and Regina
http://www.postgis.us

 

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Louwrens
du Toit
Sent: Thursday, February 03, 2011 5:38 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] Postgresql, postgis and PHP

Hi Brent,

First of all thanks for the reply and the heads up warning for
conversions... I will look into that book that you mentioned but would like
to know (like Dheeraj) if you could perhaps give me a hint on how such a
query could look? That would very much be appreciated.

Thanks again for the info.

Regards,
LJ du Toit

__________________________________________________
LJ du Toit

Max-Planck-Institute for Evolutionary Anthropology Department of Primatology
Deutscher Platz No 6
D-04103 Leipzig
Germany

e-mail    louwrence_du at eva.mpg.de
phone    ++49 (0) 341 3550 802


On 02.02.2011 19:44, Dheeraj Chand wrote:
> Brent,
>
> I confess to being in a similar boat to the OP. I just pre-ordered the
book from Amazon, but I am curious if you can get into your opinions about
whether or not it's better to do that kind of manipulation at the db level
or at the script level.  My gut tells me that it's better to do it by db.
>
> More interestingly, what would a query to accomplish his goals look like?
>
> Dheeraj
>
> On Feb 2, 2011, at 1:25 PM, pcreso at pcreso.com wrote:
>
>> Hi,
>>
>> You can use simple SQL to extract core values which you manipulate&
analyse in PHP/Javascript, or you can do more of the work in SQL. Given your
skills, it seems likely that you would find it easier to use simple SQL&
more script based processing.
>>
>> One initial point to note:
>>
>> If you are dealing with global polygons, then SRID 4326 based data can
give very strange results for area calculations. eg, the polygons:
>>
>> (0 0,  1 0,  1 1,  0 1,  0 1 ) and
>> (0 90, 1 90, 1 89, 0 89, 0 90)
>>
>> are both 1 degree square, and will give you the same area when queried.
However, these are cartesian degrees, and you want the spherical area, which
will be close to 1 degree at the equator, but a small fraction of this at
the pole.
>>
>> So, you need to either convert (transform) your coordinates to a suitable
coordinate system (identified by its SRID) before querying the area, or deal
with this issue some other way, but you need to deal with it.
>>
>> Then you can use the Postgis SQL functions to retrieve the desired area
values of the transformed polygon geometries. The Postgis docs give you good
basic instructions on the commands, but tend to assume you already
understand such issues.
>>
>>
>> Rather than write a Postgis guide here, I recommend you buy a copy of
"Postgis is Action" (http://www.manning.com/obe/) - you can download the
digital version prior to the printed edition being available.
>>
>> Otherwise a full discussion on this list could virtually replicate the
contents of the book!
>>
>>
>> Cheers,
>>
>>   Brent Wood
>>
>>
>> --- On Wed, 2/2/11, Louwrens du Toit<louwrence_du at eva.mpg.de>  wrote:
>>
>>> From: Louwrens du Toit<louwrence_du at eva.mpg.de>
>>> Subject: [postgis-users] Postgresql, postgis and PHP
>>> To: postgis-users at postgis.refractions.net
>>> Date: Wednesday, February 2, 2011, 11:24 PM Dear Postgis-Users List,
>>>
>>> I'm an experienced web developer (mainly PHP, Javascript,
>>> MySQL) and have recently started a job where I need work with 
>>> geographic information, mainly in a Postgresql database. So, I'm 
>>> quite new to all this geographical data etc and have a few 
>>> questions:
>>>
>>> So, I have a database (Postgresql) with geographical data (mainly 
>>> polygons in format "geometry" - srid 4326). Now I can do some area 
>>> (ST_Area) and intersection
>>> (ST_Intersection) queries but would like to know the
>>> following:
>>>
>>> 1. I have several tables with polygon data (layers) but need to do 
>>> queries across them (what I need to do in the end is to create 
>>> charts - bar,pie etc). I.e I would like to know for instance, what 
>>> percentage area of layer 1 falls within the area in layer 2? or 2. I 
>>> have raster data (in geotiff format), and would like to know... per 
>>> polygon (in layer 1 above), what is the mean value of the raster 
>>> data...
>>>
>>> Can someone point me in a direction of where to information like 
>>> this. How should I go about this problem?
>>>
>>> I hope this makes sense. As I said, I'm very new to all this 
>>> geographic stuff.
>>>
>>> Thank you,
>>> LJ du Toit
>>>
>>> --
>>> __________________________________________________
>>> LJ du Toit
>>>
>>> _______________________________________________
>>> 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
> _______________________________________________
> 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





More information about the postgis-users mailing list