http://drupal.org/node/1040640#comment-4299772

Personally I think data could be stored minimally for v.1.0. That is, have table columns for lat, long, and the precalc'ed fields. Also have a column for 'data' that will be a serialized keyed array of whatever else comes back from Google. As the project develops, various use cases will show which information needs to graduate out of the 'data' pile and into its own column. This way, there is an achievable goal for v.1.0 and clear room for change.

Comments

derjochenmeyer’s picture

Note: According to #690746: Text column type doesn't reliably hold serialized variables this should be a blob field...

    'geocoder_data' => array(
      'description' => 'Stores a serialized version of whatever the geocoder returns',
      'type' => 'blob',
      'size' => 'big',
      'not null' => TRUE,
      'serialize' => TRUE,
    ),
derjochenmeyer’s picture

Storing whatever the geocoder returns is a nice idea, but often the Information returned does not make any real sense.

Example: User sets a Marker on the map:

  • Google returns lat, lng for the position.
  • Google tries to reverse geocode and returns the closest address: result[0].
  • Google might return more than one result as an array of JSON objects: result[0], result[1], result[2].

What do we store besides lat, lng? The first result or all results? Do we store the fact that it was a reverse (aproximate) geocoding result?

Example: User enters text information:

  • Google tries to reverse geocode and returns the closest address (including aproximate lat, lng): result[0].
  • Google might return more than one result as an array of JSON objects: result[0], result[1], result[2].

What do we store besides lat, lng? The first result or all results? Do we store the fact that it was a reverse geocoding result based on the users textinput? Do we store the textinput itself?

Sinan Erdem’s picture

Hello Jochen,

Thank you for working on this module. It covers a big area in Drupal mapping system.

When I manually enter a point from the map, I see that an address is populated on the address textbox above map. Even storing this address as a text in a field which is accessible from views or tokens is a very good improvement. Better approach would be to store this data separated by address components (city, country etc.)

Cheers,
Sinan

markaspot’s picture

I think that google geocoding does some good job, especially on a higher zoom levels. So i would store just all information that the geocoding service provides and leave it to the application's field settings, on which level of accuracy (roof-top, city, national) your module will start showing map and geocoding.

My approach will be to store the exact output of your module'sfield_geo[und][0][address][field] in an additional address-field and to validate this before saving the node. I need an address that makes sense, means i have to validate zip and city on the server side. Thanks for this module, helped me a lot!

Funksmaname’s picture

I'm desperate for same basic functionality as #3.

http://drupal.org/node/1040640#comment-4004262 supposedly does this though the patch is failing and causing errors when manually applied. No further comments on that thread mention the patch.

Any ideas??

Funksmaname’s picture

As a workaround, I put in the following jQuery solution:

jQuery(document).ready(function($) {
    $('#edit-submit').bind('click', function(){
        $('#edit-field-address-as-text-und-0-value').val($('#edit-field-geolocation-und-0-address-field').val());
    });
});

where the first # is the text field which is hidden with css (hide the field wrapper, not the field) and the second is the goelocation address field which isn't stored anywhere. When the form is submitted, the text is copied from one field to the other and then therefore saved in the db and can be included in views etc.

#field-address-as-text-add-more-wrapper {display:none}

Hope this helps, while a more robust address storage method is agreed upon.

rli’s picture

Agree with #6 for a quick solution. Thanks.

derjochenmeyer’s picture

mtoscano’s picture

I tried to use the solution at #6, adding the code to the geolocation.js in the geolocation folder, modifying the field name to match mine and clearing cache, but it doesn't works.
Should I put that jQuery code in geolocation.js?