I know it's a bit off the grid, but just throwing something on the table.

addressfield ( http://drupal.org/project/addressfield ) is THE most promising and "famous" project for storing addresses on D7.
geofield is going to be THE module used for storing geolocation data for D7.
Currently there is no complete solution for entering and storing address data, geolocating them and displaying them on a map.
addressfield takes care of the address storing, geofield takes care of storing the coordinates data, openlayers/location takes care of displaying the data...
All that's missing is a link between the 2 first steps.
Any thoughts on this?

Comments

phayes’s picture

Yes, i've been thinking about this. I've got a solution started by porting geocode module to D7 here: http://drupal.org/project/geocode

It currently works for textfields, images, and gpx files. Let's work on it at github and get it working with addressfield and polish it up a bit. Once that's done we'll see if allie wants to port in back into d.o - if not we will include it as a submodule here.

phayes’s picture

Wait sorry, bad link. Github of D7 geocode is here: https://github.com/phayes/geocode

aristeides’s picture

Unfortunately I can't help with porting the module (lack of knowledge) but I can do extensive tests and bug reporting...
I posted this on the addressfield issue queue as well here: http://drupal.org/node/1093392 to get things started.
I'll try the geocode module later tonight, I was really glad to see your response!

eliosh’s picture

Hope to hear good news ASAP :-)
Thanks for the great and good work.

rorymadden’s picture

I get the following errors when I try to create a GeoField with a widget of "Geocode from another field "

Notice: Undefined index: geocode_field in geocode_field_widget_form() (line 120 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).

When I try to save the field I get the following errors:

Notice: Undefined index: geocode_field in geocode_field_widget_form() (line 120 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: language in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: language in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: language in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).

If I edit the field again and click save I get the following errors:

Notice: Undefined index: language in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: language in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: field_test in geocode_widget_validate() (line 138 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Warning: Invalid argument supplied for foreach() in geocode_widget_validate() (line 138 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: language in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).

These are issues with the geocode module but as it is hosted on github there is no issue queue for me to post against.

Thanks

phayes’s picture

Question: Does the geocoding actually work despite these notices? (Of course this is still a valid complaint - I tend to do my developing with notices turned off - likely a bad idea.. )

rorymadden’s picture

When I try to create a piece of content I get the following errors.

Notice: Undefined property: stdClass::$data in geocode_google->geocode() (line 109 of C:\wamp\www\pub7\sites\all\modules\geocode\includes\geocode.inc).
Notice: Trying to get property of non-object in geocode_google->geocode() (line 111 of C:\wamp\www\pub7\sites\all\modules\geocode\includes\geocode.inc).
Notice: Trying to get property of non-object in geocode_google->geocode() (line 111 of C:\wamp\www\pub7\sites\all\modules\geocode\includes\geocode.inc).
Notice: Undefined index: und in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).
Notice: Undefined index: und in geocode_widget_validate() (line 132 of C:\wamp\www\pub7\sites\all\modules\geocode\geocode.module).

The content is saved and the text field that I have linked to my Geofield is populated but nothing was saved in the Geofield field.

phayes’s picture

Status: Active » Needs review

Alright. I spent today doing a complete overhaul of geocode module over at https://github.com/phayes/geocode

As far as I can tell, it works! Please download and try again.

Note that you will need the latest version of geoPHP over at https://github.com/downloads/phayes/geoPHP/geoPHP.tar.gz

aristeides’s picture

Sorry I wasn't able to test anything for a couple of weeks but I have a strict deadline on a project I'm working on... I' ll give it a try probably later today.

rorymadden’s picture

This is looking a lot better. Thanks. Steps I followed:
Installed:
Addressfield (alpha1)
Geofield (alpha1)
Geocode (github)
Libraries (1.0) - and installed latest GeoPHP
Ctools (alpha4)
OpenLayers (alpha1)

I am using Php 5.3.3

I added a Google Maps API key to OpenLayers
Create new content type with Address Field and Geofield with Widget: "Geocode from another field" (Addressfield)

After setting up the field Geofield on my content type I get the following errors:
Notice: Undefined index: language in geocode_widget_validate() (line 196 of /home/quickstart/websites/example.dev/sites/all/modules/geocode/geocode.module).
Notice: Undefined index: language in geocode_widget_validate() (line 196 of /home/quickstart/websites/example.dev/sites/all/modules/geocode/geocode.module).
Notice: Undefined index: language in geocode_widget_validate() (line 196 of /home/quickstart/websites/example.dev/sites/all/modules/geocode/geocode.module).

I create a piece of content and it works!! There is data now being stored in my geofield. Woohoo

Display Type: OpenLayer
However when I set the display type of the geofield to OpenLayers with Full Geometry option I get the following error:
Notice: Undefined index: format in geofield_field_formatter_view() (line 71 of /home/quickstart/websites/example.dev/sites/all/modules/geofield/geofield.formatters.inc).

Openlayers outputs a line: Can't output openlayers yet

Display Type: Lat/Lon, lat only, lon only, geometry type
These work fine

Display Type: GeoJSON, WKT
The value displays but I get the following error
Notice: Undefined index: format in geofield_field_formatter_view() (line 71 of /home/quickstart/websites/example.dev/sites/all/modules/geofield/geofield.formatters.inc).

This looks like its almost there (although I may have missed a set up task). Thanks

phayes’s picture

Status: Needs review » Needs work

@rorymadden,

It doesn't sound like you've missed anything. That's the state of things at the moment - basically working with a lot of rough edges. Thanks for testing. I'm going to mark this as needs work for now while I clean up the rough patches.

aristeides’s picture

Just wanted to confirm... same errors for me, but it almost works!!! :D

Shadlington’s picture

Subbing

phayes’s picture

Status: Needs work » Needs review

The errors should now be gone and D7 geocode is basically stable (as far as I can tell). Please test!

rorymadden’s picture

No more errors! Thanks for that. However I am still getting the line "Cant output openlayers yet." when I set the display type to OpenLayers.

Is this a setup issue, an issue with geocode or an issue with OpenLayers? (I followed the same setup as before - #10)

Thanks again.

aristeides’s picture

Everything seems to works flawlessly!

michaelfavia’s picture

@rorymadden - openlayers isnt a supported display formatter yet IIRC.

@phayes - excellent work. You saved me a ton of glue and matchsticks today and i owe you a beer at the next drupalcon.

phayes’s picture

Alright i'm marking this as fixed

phayes’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

vasike’s picture

Status: Closed (fixed) » Active

It seems that it's not working with latest dev version of the modules : Addressfield, Geofield, Geocode (github), OpenLayers
It won't saved any Geo data for the Geofield. No errors

g76’s picture

sub

Loikkk’s picture

sub

Loikkk’s picture

Category: feature » bug
vasike’s picture

i discover 2 reasons for this issue

1. for the AddressField values in a multilingual drupal
The field won't use the right Language Key, instead it uses the the 'und' key

Possible Solution
This could be solved but enabling the Entity translation module & both the Geofield & the Addressfield have th "Users may translate this field." option Checked

2. The Geocode Google for the Addressfield data won't work if the php "allow_url_fopen" is Off

Anyway i'm not sure this is an issue for this module.

pixelmord’s picture

The workaround of #25 works for me, but that shouldn't be done like this, no?
In a content translation setup with nodes beeing translated, the fields should receive the correct language key automatically. Or am I missing something here?

jaxxham’s picture

Hi there, the geocode module has suddenly started returning this error when trying to save an address field:

Notice: Uninitialized string offset: 0 in geocode_widget_validate_walkthrough() (line 247 of ... /sites/all/modules/phayes-geocode-281c70f/geocode.module).

Any ideas?

itserich’s picture

I am getting the same error as in #27, when a node is saved.

Notice: Uninitialized string offset: 0 in geocode_widget_validate_walkthrough() (line 247 of modules/phayes-geocode-281c70f/geocode.module).

Also, I was getting an error for Content Type B (Geocode Demo)when I was saving Content Type A - unrelated Content Types.

Notice: Undefined property: stdClass::$field_geocode_demo in openlayers_proximity_build_proximity_index() (line 244 of /modules/jpstrikesback-proximity-9a06988/openlayers_proximity.module).

I deleted Content Tye B and that error now does not appear when a node is saved, but the error reported in #27 remains.

The mapping for the individual node and an aggregate node map both appear to work fine. The area where it does not work is the Proximity module.

I am using

Address Field 1.0 Beta
OL 7 2.x Dev
OL Proximity 7 2.x Dev

Using Google Geocoder from the Address Field.

Brandonian’s picture

Status: Active » Fixed

This error doesn't seem to happen when you use the latest versions of Addressfield (7.x-1.0-beta2), Geofield (7.x-1.0-alpha4), and the Treehouse Agency version of Geocode (https://github.com/treehouseagency/geocode).

I also have a fork of Geocode (https://github.com/fillerwriter/geocode) that I plan on keeping up to date with bug fixes.

itserich’s picture

When I try both geocode versions in # 29 I get this error when saving a node:

Notice: Uninitialized string offset: 0 in geocode_widget_validate_walkthrough() (line 280 of xxx/geocode.module).

It appears tobe the same error as in # 27 with a different line number.

I think I am using the latest Address Field and OpenLayers.

I don't know if anything needs to be done when switching geocode versions, I ended up clearing cache.

Shadlington’s picture

I'm struggling to get this to work...
I think the problem is that geocode isn't working - no data is being saved in my geofield.
Does anyone have any idea why that might be the case? I have followed the same steps as in #10.

tvilms’s picture

I'm struggling with the same problem in one of my D7 implementations - but not the other - and I can't for the life of me isolate what's different between the two implementations. One is geocoding just fine, the other isn't.

One thing of note is the error message I'm getting in the non-working implementation. It's different than what others are showing here in this thread:

"Notice: Trying to get property of non-object in GoogleGeocode->read() (line 51 of .../public_html/sites/all/libraries/geoPHP/lib/adapters/GoogleGeocode.class.php)."

I'm using:
D7.7
CTools 7.x-1.0-rc1
OpenLayers 7.x-2.x-dev
Geocode (tried three diff versions on github)
Geofield 7.x-1.0-alpha5 (tried multiple older versions)
Address Field 7.x-1.0-beta2 (tried several older versions)
Libraries 7.x-1.0
geoPHP from PHayes
Tried both GoogleMaps API v2 (with key) and v3.2

Has anyone debugged these issues and gotten to the point where Geofield is successfully storing data geocoded from the address field? Please tell how.

Status: Fixed » Closed (fixed)

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

nagiek’s picture

Status: Closed (fixed) » Active

opening again because it doesn't seem like it's fixed.

subscribe

nagiek’s picture

although I should say it works fine for me with the Treehouseagency release. Maybe it depends on the quality of your address?

Will geocode 7.x be released using these combined modules?

michaelfavia’s picture

Status: Active » Closed (fixed)

This issue has been resolved by phayes and indytechcook work on the geocoder module which geocodes addresses into geofield points. You can get it from their github repositories linked above or a new project created to house it on drupal.org. Im trying to recentralize the work on this project on drupal.org and welcome any competent comaintainers to push it forward.

http://www.drupal.org/project/geocoder