Hi Sushu,

First of all thank you for developing the module, but there is one thing left for me at least. How does it work? what Kind of Values should be specified in the Fields Handler and Address. I tried it with what I could guess:

Handler: 'WKT'
Address: 'Some Address'

but the module doesn't seem to geocode these values.
I work with Geocoder 7.x-1.2 and Rules 7.x-2.3 and would be very glad for some hints.

Thanks in advance
m-si (Germany)

Comments

shushu’s picture

Hi,
Sorry for the delay (went to the drupalcon...),
Hope to get back to you in few days...
Shushu

shushu’s picture

Status: Active » Needs review

Hi,

  • Handler - the external web services to be used for geocoding. The geocoder module support a number of handlers (exif, google, gpx, json, kml, latlon, mapquest_nominatim, wkt, yahoo, yandex), but I only used "google" till now. For reverse geocoding only "google" handler exist for now.
  • Address - this is the text you want to geocode. For testing, put a real address, not just any string.

Hope this helps.
Shushu

andrija.petrovic’s picture

I just wonder how to assign the output of "Geocode a location" to some field?

Best regards,
Andrija

shushu’s picture

Hope exporting a test rule will help you.
If not, please let me know.

{ "rules_check_geocoder" : {
    "LABEL" : "check geocoder",
    "PLUGIN" : "reaction rule",
    "REQUIRES" : [ "rules", "geocoder_rules", "php" ],
    "ON" : [ "node_presave" ],
    "IF" : [
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_test2" } },
      { "entity_has_field" : { "entity" : [ "node" ], "field" : "field_location_name" } }
    ],
    "DO" : [
      { "geocoder_rules_geocode" : {
          "USING" : {
            "handler" : "google",
            "address" : "\u05e0\u05d0\u05d5\u05ea \u05d4\u05db\u05d9\u05db\u05e8"
          },
          "PROVIDE" : {
            "longitude" : { "longitude" : "Longitude" },
            "latitude" : { "latitude" : "Latitude" },
            "accuracy" : { "accuracy" : "Accuracy" }
          }
        }
      },
      { "drupal_message" : { "message" : "long=\u003C?php echo $longitude;?\u003E, lat=\u003C?php echo $latitude;?\u003E\r\n" } },
      { "geocoder_rules_reverse_geocode" : {
          "USING" : {
            "handler" : "google",
            "latitude" : [ "node:field-test2:lat" ],
            "longitude" : [ "node:field-test2:lon" ],
            "language" : "iw"
          },
          "PROVIDE" : {
            "address" : { "address" : "Address" },
            "accuracy" : { "accuracy2" : "Accuracy" }
          }
        }
      },
      { "drupal_message" : { "message" : "Address=\u003C?php echo $address; ?\u003E, accuracy=\u003C?php echo $accuracy2;?\u003E" } },
      { "data_set" : { "data" : [ "node:field-location-name" ], "value" : [ "address" ] } }
    ]
  }
}
shushu’s picture

Status: Needs review » Closed (works as designed)