Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
this might be helpful. the patch adds a rule action that converts a pair of latitude and longitude values into the data structure required by geofield.
and example use case is provided in the attached feature. it contains two rules components for automatically geocoding existing nodes based on http://drupal.org/project/rules_geocoder
Comment | File | Size | Author |
---|---|---|---|
#10 | geofield-rules-1976732-10.patch | 604 bytes | marc.groth |
Comments
Comment #1
dasjoComment #2
reysharks CreditAttribution: reysharks commentedWorks for me :)
Comment #3
geek-merlin@dasjo: i like your patches!
worksforme, and is very useful
So setting rtbc.
Comment #4
Brandonian CreditAttribution: Brandonian commentedThanks for the patch, @dasjo! Committed to 7.x-2.x
http://drupalcode.org/project/geofield.git/commit/22f0462
Comment #6
Brandonian CreditAttribution: Brandonian commentedMarking as fixed.
Comment #8
Tranko CreditAttribution: Tranko commentedHello!
I found a problem with rules componentes, geoPHP is not initialized when a rule component want create a geofield value to assing a node.
I add geoPHP::load(); before the class Point and its works fine!
Regards,
Tranko.
Comment #9
pio.fernandes CreditAttribution: pio.fernandes commented#8 was totally on it. I had to add "geophp_load();" inside geofield_rules_create_values function in geofield.rules.inc
Hope it helps somebody.
Comment #10
marc.groth CreditAttribution: marc.groth commentedI had the same problem as #8 and #9, so I'm sure this is not just an edge case.
I have attached a patch that fixes the issue. Could this be reviewed and then included in the next release please?
Comment #11
geek-merlinAh this makes sense code-wise.
Comment #12
geek-merlinThe patch aplies well and makes sense codewise.
Note: to apply the patch, use something like this:
patch -p7 <../geofield-rules-1976732-10_0.patch
@marc.groth:
the standard is to base pytches on the module dir (and apply them with -p1), not the drupal base dir.
Comment #13
steveoriol#10 works to me, cool :-)
Comment #14
fubarhouse CreditAttribution: fubarhouse commentedAny chance of getting this released, I would *really* like to fix a very old problem on one of our sites...
Comment #15
coreteamvn CreditAttribution: coreteamvn commentedFor those who are not so familiar with patching, just add geophp_load(); to the function below in sites/all/modules/geofield/geofield.rules.inc
/**
* Rules action for creating geofield values from lat/lon.
*/
function geofield_rules_create_values($lat, $lon) {
geophp_load();
$geometry = new Point($lon, $lat);
$value = geofield_get_values_from_geometry($geometry);
return array(
'geofield' => $value
);
}
Comment #16
sano CreditAttribution: sano as a volunteer commentedThis works for me as well. Thanks.
It's 1919, the patch has been marked as rtbc almost 3 years ago... How can I help to have this committed?
(I lost couple of hours dealing with this problem)
Comment #18
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedThanks all! Fixed the missing geoPHP inicialization.