List Info

Thread: What is the easy way to read and write GPS data?




What is the easy way to read and write GPS data?
user name
2007-10-15 11:00:00
Hello guys,

I'm very new to OOP and PEL is really scares me. I'm trying to read GPS data from photos, but I can't.

I'm trying this:

--------------------
$file = "/home/re/gps1.jpg";
$data = new PelDataWindow(file_get_contents($file));

$jpeg = new PelJpeg();
$jpeg->load($data);
$app1 = $jpeg->getExif();
$tiff = $app1->getTiff();

$ifd0 = $tiff->getIfd();
$entry = $ifd0->getEntry(PelTag::GPS_LONGITUDE);

print "Longitude: ".$entry;
--------------------

But I get nothing. What am I doing wrong?


Another question is how can I easy add Exiff data, even if JPEG file doesn't have any Exif data in it? Is there any PHP sample that shows how can I do it?
Re: What is the easy way to read and write GPS data?
country flaguser name
Denmark
2007-10-18 14:44:26
"Al Pro" <applepro7777gmail.com> writes:

Hi,

Your message was stuck in moderation -- I have now
configured the list
to allow your address to post. I've CCed this reply to you
too, let us
know if you don't want that.

> I'm very new to OOP and PEL is really scares me.

Well, PEL is rather OO heavy... consider it a fun way to
learn OO 

> I'm trying to read GPS data from photos, but I can't.
>
> I'm trying this:
>
> --------------------
> $file =3D "/home/re/gps1.jpg";
> $data =3D new PelDataWindow(file_get_contents($file));
>
> $jpeg =3D new PelJpeg();
> $jpeg->load($data);

In PEL 0.9.1 you can simply do

  $jpeg =3D new PelJpeg($file);

and then PEL will figure out to load the data from the file.
It is
simply shorter than what you wrote, but does the same.

> $app1 =3D $jpeg->getExif();
> $tiff =3D $app1->getTiff();
>
> $ifd0 =3D $tiff->getIfd();
> $entry =3D $ifd0->getEntry(PelTag::GPS_LONGITUDE);
>
> print "Longitude: ".$entry;
> --------------------
>
> But I get nothing. What am I doing wrong?

The GPS data is not stored in the IFD0. So the getEntry()
call returns
null. You need to do:

  $gps =3D $ifd0->getSubIfd(PelIfd::GPS);

and then your GPS_LONGITUDE entry should be in the $gps
IFD.

If you think this is complicated, then I agree  PEL parses
the
structure for you, but you still need to know where to find
the right
bits of information. Using the dump-image.php file can
help.

> Another question is how can I easy add Exiff data, even
if JPEG file
> doesn't have any Exif data in it? Is there any PHP
sample that shows
> how can I do it?

Please have a look at this URL in which a user explained how
he added
data (including GPS!) to an empty JPEG file:

http://sf.net/tracker/?fun
c=3Ddetail&atid=3D650323&aid=3D1815728&group_id=

=3D108380

=2D-=20
Martin Geisler  ---  <mgeislermgeisler.net>  ---  http://mgeisler.net

------------------------------------------------------------
-------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and
a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
PEL-devel mailing list
PEL-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pel-devel


Re: What is the easy way to read and write GPS data?
user name
2007-10-19 10:32:43
>>>;> Your message was stuck in moderation -- I have now configured the listto allow your address to post. I've CCed this reply to you too, let us

I9;m new to mailing lists. I wonder, why I can't see your message in pel-devel lists? And how can I post replies there?

> I'm very new to OOP and PEL is really scares me.
>>>>; Well, PEL is rather OO heavy... consider it a fun way to learn OO



I actually read little bit about OO in PHP book I have, I need to buy some book for professional I think.

> I'm trying to read GPS data from photos, but I can't.
>>&gt;> In PEL 0.9.1 you can simply do
>>;>> $jpeg = new PelJpeg($file);
>&gt;>> The GPS data is not stored in the IFD0. So the getEntry() call returns
>>>;> null. You need to do:
>&gt;>>
>>&gt;> $gps = $ifd0->getSubIfd(PelIfd::GPS);
>>&gt;>
>>&gt;> and then your GPS_LONGITUDE entry should be in the $gps IFD.
>;>>&gt;
>>&gt;> If you think this is complicated, then I agree PEL parses the
>&gt;>> structure for you, but you still need to know where to find the right
>>>>; bits of information. Using the dump-image.php file can help.

Thanks Martin.
&nbsp;
> Another question is how can I easy add Exiff data, even if JPEG file
> doesn't have any Exif data in it? Is there any PHP sample that shows
&gt; how can I do it?
>&gt;>> Please have a look at this URL in which a user explained how he added
>>>>; data (including GPS!) to an empty JPEG file:
>>>>; http://sf.net/tracker/?func=detail&atid=650323&amp;aid=1815728&group_id=108380

That&#39;s exactly what I need. Thanks. Can you tell me what includes does it needs? Is convertGps() a part of PEL?
Re: What is the easy way to read and write GPS data?
country flaguser name
Denmark
2007-10-21 13:19:51
"Al Pro" <applepro7777gmail.com> writes:

>> Your message was stuck in moderation -- I have now
configured the
>
> I'm new to mailing lists. I wonder, why I can't see
your message in
> pel-devel lists? And how can I post replies there?

You are thinking of the archive at SourceForge, right:

  http://sf.net/mailarchive/forum.php?forum_name=3Dpel-d
evel

I don't know why my reply hasn't showed up there yet. It is
archived
at the other archives that carry the pel-devel list:

  http://article.gmane.org/gmane.comp.web.pel.devel/183
  http://www.mail
-archive.com/pel-devellists.sourceforge.net/msg00149.html

To post replies you have to use the "reply-all"
button in your email
client -- the important point is that you include

  pel-devellists.sourceforge.net

as a recipient. By the way, I have just redirected your last
mail (the
one I am replying to) to the list 

>>> Another question is how can I easy add Exiff
data, even if JPEG
>>> file doesn't have any Exif data in it? Is there
any PHP sample
>>> that shows how can I do it?
>>
>> Please have a look at this URL in which a user
explained how he
>> added data (including GPS!) to an empty JPEG file:
>> http://sf.net/tracker/?func
=3Ddetail&atid=3D650323&aid=3D1815728&group_i=
d=3D108380
>
> That's exactly what I need. Thanks. Can you tell me
what includes
> does it needs? Is convertGps() a part of PEL?

No, convertGps is a custom function written by Andac. The
complete
source is now online here:

  http://sf.net/tracker/index.ph
p?func=3Ddetail&aid=3D1816464&group_id=3D10=
8380&atid=3D650324

I will of course put it in PEL when it has been cleaned up a
bit.

=2D-=20
Martin Geisler  ---  <mgeislermgeisler.net>  ---  http://mgeisler.net

------------------------------------------------------------
-------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and
a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
PEL-devel mailing list
PEL-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pel-devel


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )