[gdal-dev] Re: Reviving the PHP Bindings

Joris van de Sande joris.devplace at gmail.com
Sat Feb 12 08:19:06 EST 2011


Hi Mike,

I didn't use the PHP bindings that come with GDAL, because at that
time I didn't know about it's existence.

I created a little C file with 2 functions in it. One to convert from
proj4 to WKT and the second function converted WKT format to proj4.
See the attachment for the source code. I have used the GDAL C++ API
as you will see in the source code.

>From that C file I created a PHP module with SWIG.

I have played with the PHP bindings of GDAL yesterday. A lot of work
must be done to make the PHP bindings up to date. The main reason that
not everything is working as expected with the PHP bindings is because
of incomplete SWIG typemaps (that's my conclusion). Compared to the
python bindings, a lot is missing in the PHP bindings.

It's too much work to make the PHP bindings up to date at once. So in
my opinion the best solution is to determine in which order the
various GDAL parts should be implemented in the PHP bindings.

-Joris

On Sat, Feb 12, 2011 at 12:05 AM, Mike Leahy
<mgleahy at alumni.uwaterloo.ca> wrote:
> Hi Joris,
>
> You're ahead of me already, as I don't have any real experience with C/C++.
>
> However, I would be interested to see specifically how you're getting the
> SpatialReference objects to work...since I'm at least able to compile and
> load that particular module. Do you have a bit of sample code that can
> demonstrate this? As I noted in a previous post to this list, I seem to get
> zeros returned by the relevant functions...so either the compiled module I
> have isn't working right, or I'm not using it right. It would be helpful if
> I could compare my tests with the way you've done it.
>
> Best regards,
>
> Mike
>
> On Friday, February 11, 2011 12:00:11 Joris van de Sande wrote:
>
>> Date: Fri, 11 Feb 2011 12:50:41 +0100
>
>> From: Joris van de Sande <joris.devplace at gmail.com>
>
>> Subject: [gdal-dev] Reviving the PHP Bindings
>
>> To: gdal-dev at lists.osgeo.org
>
>>
>
>> Message-ID:
>
>> <AANLkTin4SjA8uqswvFY9E0ZKV86esfYdgrB=uAaXHrtP at mail.gmail.com>
>
>>
>
>> Content-Type: text/plain; charset=ISO-8859-1
>
>>
>
>> Hello,
>
>>
>
>> This is a reply to the PHP Bindings thread that has been started by
>
>> Mike Leahy.I have just registered with the list, so I was not able to
>
>> reply to the thread.
>
>>
>
>> I am also interested in getting the PHP bindings for GDAL up to date.
>
>> Right now we're using the gdal command line utilities a lot from
>
>> within PHP. We're relying on regular expressions to parse the output
>
>> at the moment. So it would make development a lot easier if we could
>
>> use the internal GDAL classes and functions from within PHP.
>
>>
>
>> A few months ago I have created a little PHP module that converts
>
>> projection strings from wkt to proj format (and vice versa) using the
>
>> SpatialReference class. But it would be great if more functionality
>
>> could be used from inside PHP.
>
>>
>
>> What can be done to revive the PHP bindings? Are more people interested
>
>>
>
>> I am a PHP developer with some knowledge of C/C++. My main interest at
>
>> the moment are:
>
>> 1. Using the SpatialReference class from within PHP
>
>> 2. Retrieving map(meta)data like gdalinfo does from within PHP
>
>>
>
>> Regards,
>
>> Joris van de Sande
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wkt_proj.cpp
Type: text/x-c++src
Size: 1324 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110212/756c0441/wkt_proj.bin


More information about the gdal-dev mailing list