If the location.module is installed, and the user doesn't enter a location why not have the GPS co-ords pulled from the Exif tags?
This is sort of a duplicate of http://drupal.org/node/143071 but belongs more in the Exif module.
I made a start at such functionality and it's working on our site. See http://drupal.org/node/143071#comment-310009 for quick and dirty code.
This code needs a bit of cleaning but the basic idea is working. Probably improvements:
1. Check for location.module installed/active properly.
2. Couple of configuration options to a) activate this feature, b) determine what happens on image re-submission.
Comment | File | Size | Author |
---|---|---|---|
#20 | exif_location.tar_.gz | 1016 bytes | raintonr |
#4 | exif.178370_1.patch | 11.03 KB | raintonr |
#2 | exif.178370_0.patch | 13.49 KB | raintonr |
#1 | exif.178370.patch | 13.5 KB | raintonr |
Comments
Comment #1
raintonr CreditAttribution: raintonr commentedHere's another patch with:
- Improved checking for location.module.
- Admin menu items to enable/disable the function & start rescan.
- Cron hook to process image files in batches if scan is started. Allows GPS locations to be harvested from existing images when scan restart admin option is chosen.
Comment #2
raintonr CreditAttribution: raintonr commentedOops... slight problem with the last patch. Completely disables Exif if locations are not present on the module. This one should be better.
Comment #3
neclimdulDo you think you could make a version of your patch that's in line with the drupal patch guidelines?
http://drupal.org/patch/create
Specifically cvs -up
Comment #4
raintonr CreditAttribution: raintonr commentedHi,
diff -up patch attached as requested.
This is between the release I originally patched (1.0) and my update. I notice some things have changed a bit in 1.1. If you don't have time to do this merge I can try and update to 1.1 and re-do my changes. Please let me know if that's required.
Comment #5
David Lesieur CreditAttribution: David Lesieur commentedMarked #363894: Fill location information on GPS Exif tags V6 as a duplicate.
Comment #6
rapsli CreditAttribution: rapsli commentedcan somebody help me on this? I'm working on the D6 branch -> the feature to integrate Coords into CCK. It's actually pretty simple, but: I don't know how to intepret the data:
the exif comes out as an array:
#
value (Array, 3 elements)
* 0 (String, 4 characters ) 49/1
* 1 (String, 4 characters ) 44/1
* 2 (String, 19 characters ) 2147483631/82532375
This is just the latitute. How do I have to put this together in order to make real coords?
Plus. Location CCK: In which way do the coords have to be entered? Please provide an example. I'll then make sure to get that in.
Comment #7
raintonr CreditAttribution: raintonr commentedTo figure out how to get co-ords from EXIF, look in the patch, specifically at these parts:
...
Comment #8
emagus CreditAttribution: emagus commentedsubscribing
Comment #9
raintonr CreditAttribution: raintonr commented@rapsli Was #7 any good or do you need more info?
Comment #10
emagus CreditAttribution: emagus commentedComment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedi'm trying to get this working with the latest D6 version. the patch is for a very old version and does not help me. can anyone give me suggestion where to tweak the module to get it working?
Comment #12
raintonr CreditAttribution: raintonr commentedI'd given up getting this inserted into the exif module and wrote a small exif_location module. Will post more details when it's fit for public consumption ;)
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commentedi am happy for code in any condition. waiting for a solution to this problem to send a site live.
Comment #14
emagus CreditAttribution: emagus commentedgreat news raintonr. waiting patiently
Comment #15
spl13 CreditAttribution: spl13 commentedsubscribing - waiting for exif_location
Comment #16
rapsli CreditAttribution: rapsli commentedapplied a patch to head. let's get this one here moving on next. Anybody willing to volonteer for a patch? I'm more than welcome to apply it.
Comment #17
mathmeye CreditAttribution: mathmeye commentedHi Rapsli,
Works only for me if I prepend "gps_" to "gpslatitude" and "gps_gpslongitude" in lines 240 and 243 respectively.
Comment #18
raintonr CreditAttribution: raintonr commentedRe: #17, see patch here: http://drupal.org/node/473140#comment-2186358
Comment #19
rapsli CreditAttribution: rapsli commentedComment #20
raintonr CreditAttribution: raintonr commentedActually, this isn't a duplicate.
I spoke about making a exif_location module though, please see attached tar file. Think it would be nice to bundle this with exif module.
Testing of this was hardly thorough, but works for me. YMMV.
Comment #21
raintonr CreditAttribution: raintonr commentedAnyone tried #20? Thoughts on integrating or bundling with the EXIF module?
Comment #22
rapsli CreditAttribution: rapsli commentedlet me have a look at this next week when there's more time.
Comment #23
TUc CreditAttribution: TUc commentedI tried the code in #20. Worked like a charm.
Comment #24
emagus CreditAttribution: emagus commentedHow did you do it? What fields do you have to add, and what else has to be done? I just can't get it to work...
Comment #25
TUc CreditAttribution: TUc commentedThe problem is that, currently, you have to account for a few different issues:
1) The $op in hook_nodeapi that should handle the storage of EXIF information in the $node object. IMO, this should be "presave".
2) The correct key usage in the function _exif_reformat(): "gps_gpslatitude" and "gps_gpslongitude" instead of "gps_latitude" and "gps_longitude".
3) The correct execution order of anything in hook_nodeapi() in exif_location module relative to the code in (1) above.
It isn't that complicated, but it requires a few hacks in Exif module.
I want to work on this, but I have no idea of the latest code status for Exif module. It seems dispersed.
@rapsli: are you willing to make a new release soon that incorporates al these changes?
Comment #26
rapsli CreditAttribution: rapsli commentedthis is still experimental, as I didn't get around testing it. Just had a brief look at it. Let's find out, how well the community is working. It's committed to HEAD.
Comment #27
rapsli CreditAttribution: rapsli commentedcommitted this to 6.1 branch.
Comment #29
mawosch CreditAttribution: mawosch commentedI try to use the "Exif Location" Sub-Module.
The Location Module is installed and coordinate input is activated for the nodetype. While creating the node I can see the lat and lon fields. In Exif-Module settings the nodetype is active too.
But after uploading a picture with GPS data, the coordinate is not in the Location module. Do I have to create additional CCK fields? Forgotten settings?
Can anybody give me a How-To of bringing GPS data from the filefield picture to the location field via "Exif Location"?
If I understand that and it works here, I can write a README for the "Exif Location" Sub-Module.
Comment #30
rapsli CreditAttribution: rapsli commentedComment #31
ispboy CreditAttribution: ispboy commentedmy solution:
vi "exif/exif.class.php"
goto line 77 nearby, replace:
with:
finished. it works!
addtionally, for the photo without gps information, it would display warnning! so
modify the exif.module, line 282
Comment #33
jphautin CreditAttribution: jphautin as a volunteer commentedComment #34
jphautin CreditAttribution: jphautin as a volunteer commented