hi,
from reading http://groups.drupal.org/node/20314 I think that this module (and it's friends) is what I need. But I do not get it to work, or do not understand how to use it?
I enabled geo and geocode, geo field and geocoded value modules.
I went to my CCK content type that contains already an filefield imagefield.
I add a new field named "geo", type "geospatial data" and choose the widget "geocoded from another field".
In the next step I get a checkbox next to the name of my cck content type that I "check". Below this is a dropdown that has one value "File field" which is the selected one. Below that is another dropdown "Return value" with one possible value "linestring".
Further down in Global settings, I choose the type "Data type" "Point".
When I now go to a "CCK Image" content (it has one image with location data in exif) for the first time I get
Cannot get geometry object from data you send to the GEOMETRY field query: CREATE SPATIAL INDEX content_field_geo_field_geo_geo_idx ON d6demo_content_field_geo (field_geo_geo) in /kunden/mydomain/DRUPAL/drupal-6.10/sites/mydomain/modules/geo/db/mysql_spatial.inc on line 30.
Probably as a result of this error I cannot see anything that relates to geocoding in my CCKImage.
My MySQL Database seems to be spatial enabled, as one of the content type tables has
field_geo_wkt longtext
field_geo_lat double
field_geo_lon double
field_geo_geo point
So, what went wrong? Where have I made a mistake?
Does anybody know of another way/module to deal with location data in exif in cckimage?
thank you
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | 2009-04-20_220138.png | 3.95 KB | ansorg |
| #6 | 2009-04-20_221549.png | 3.75 KB | ansorg |
Comments
Comment #1
ansorg commentedComment #2
becw commentedThis bug goes beyond the geocode module--this SQL error shows up whenever you add a new geo field to a content type with existing nodes.
MySQL can't create a spatial index on a field if the field contains invalid geometry data--like if the field is empty. Two things combine to cause the bug in this issue:
So when you add a new Geo field to a content type with existing nodes, CCK creates rows with blank values in the geospatial column. Then Geo tries to create an index on that geospatial column, which now has invalid geometry data in it--MySQL needs WKB, CCK populates the fields with ''.
I'm not sure about the best way to solve this--should rows with '' instead of WKB in the geospatial data column just be arbitrarily dropped before trying to create a spatial index? (@allie)
Comment #3
ansorg commentedhi,
thank you for the explanation. I started from scratch, created the CCK fields while no nodes exist yet. No error messages.
But now to the other part of my initial question: how to make it actually work? After uploading an JPG with geo data in exif I see nothing on the generated node, not even a label for the geo field that is part of this node.
Yould it be that the "filefield" offers a "linestring" but gps coordinates in the image are a "point"?
Comment #4
allie micka"I'm not sure about the best way to solve this--should rows with '' instead of WKB in the geospatial data column just be arbitrarily dropped before trying to create a spatial index? (@allie)"
I can't think of a case where having '' in any pending-wkb column would be useful, so my first inclination is to let it drop.
Alternatively, perhaps we can stop telling CCK that there's a geo column at all? When I was constructing the field module, I was hoping to outsource more of the field manipulation to CCK instead of managing it myself. In the 'database columns' op of hook_field I define a blob field like so:
But eventually I found myself implementing the INSERT/UPDATE, and then SELECT portions on my own, so it's not even useful for that column to exist as far as CCK is concerned. Thus, perhaps it's safe to remove geo from the 'database columns' definition and then remove this line from _geo_field_init:
db_drop_field($ret, $table, $column);This begs the question of why we're bothering to let CCK store anything at all ( the wkt, lat and lon columns are arguably disposable ). I was hoping to stay as CCK-compatible as possible in case we could re-outsource everything later, but if this creates more problems than it fixes, perhaps we simply manage the table on its own?
Comment #5
becw commented@allie -- One parallel from other modules that provide complex field functionality is that CCK is only trusted with an id anyway, rather than the full field data; for example, in location.module (the example I am most familiar with) all the bits and pieces of addresses stored by Location are kept in the {location} table with a location id, while cck stores only the location id. This would also address some of the issues around geo's current behavior of forcing cck fields to multiple values.
@ansorg -- it looks like extracting lat/lon from EXIF data is supported when using imagefield rather than filefield... the only geocoding linked to filefields at this point seems to be GPS track data from .gpx files (as you have noticed :)
Comment #6
ansorg commentedYes, right. I did create an imagefield (filefield of type image). then, in the geo field, I can select my "cckimage" but in the handler dropdown there is only "File field" listed.
I cannot see where I could have made a mistake?
Comment #7
becw commented@ansorg -- I meant the "imagefield" module, see http://drupal.org/project/imagefield
Comment #8
ansorg commentedyes, that's what I have installed and used for the cckimage node type (together with imagecache for display of images in different sizes)
Comment #9
becw commented@ansorg -- well, it looks like the imagefield cck field type is "filefield", while the Geocode module expects it to be "imagefield". This should be changed on line 18 of geocode/includes/modules/imagefield.inc:
er, this part of the issue probably belongs over in Geocode's queue... http://drupal.org/project/issues/geocode :)
Comment #10
ansorg commentedGreat!
In my copy of geocode, before I changed to filefield, it read
but it fixes the issue, I have my geo locations now in the node. Need now to figure out how to use it, ;)
reposted in http://drupal.org/node/440708
Thank you
Comment #11
allie mickaI'm optimistically marking this as fixed by http://drupal.org/cvs?commit=223658 .
If you encounter other issues, please open a new ticket, as I'm having a hard time groking how all the geocode hook stuff is related to Geo, and whether or not Geo needs to be doing anything accordingly :)
Thanks!
Comment #13
wisu commented@ansorg
This solution enabled the Image field option of the Geocode Handle:
but the Return value: option still shows linestring... is there anything else to do to change it?
Thanks