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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dasjo’s picture

Status: Active » Needs review
reysharks’s picture

Works for me :)

geek-merlin’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

@dasjo: i like your patches!

worksforme, and is very useful
So setting rtbc.

Brandonian’s picture

Thanks for the patch, @dasjo! Committed to 7.x-2.x

http://drupalcode.org/project/geofield.git/commit/22f0462

Brandonian’s picture

Status: Reviewed & tested by the community » Fixed

Marking as fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Tranko’s picture

Hello!

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.

pio.fernandes’s picture

#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.

marc.groth’s picture

Status: Closed (fixed) » Needs review
FileSize
604 bytes

I 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?

geek-merlin’s picture

Ah this makes sense code-wise.

geek-merlin’s picture

Status: Needs review » Reviewed & tested by the community

The 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.

steveoriol’s picture

#10 works to me, cool :-)

fubarhouse’s picture

Any chance of getting this released, I would *really* like to fix a very old problem on one of our sites...

coreteamvn’s picture

For 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
);
}

sano’s picture

This 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)

  • poker10 committed 8a802196 on 7.x-2.x authored by marc.groth
    Issue #1976732 by dasjo, marc.groth, geek-merlin, Brandonian, Tranko,...
poker10’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all! Fixed the missing geoPHP inicialization.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.