Community

[SOLVED] Geofield Decoding One-Line Address

I'm trying to geocode an address onto an OpenLayer map. The address is in this format:

825 Rinehart Rd Lake Mary, FL 32746-4867

How can I convert this using Geofield and/or Geocoder?

Comments

Address_field module?

- Erek J

And then there was Drupal

Is there a way to decode a

Is there a way to decode a text field? My content type is already configured with a text field for location.

## Note: The above code is fictitious. Any resemblance to real or actual working code is purely coincidental.

Change it?

Change it?

- Erek J

And then there was Drupal

You can't change the field

You can't change the field type once it has data in it.

## Note: The above code is fictitious. Any resemblance to real or actual working code is purely coincidental.

I guess you could use some

I guess you could use some php to break up the field but that sounds like a lot of work.

- Erek J

And then there was Drupal

I'm probably going to end up

I'm probably going to end up using Views PHP to geocode via Geocoder API. I'm looking at the API now.

## Note: The above code is fictitious. Any resemblance to real or actual working code is purely coincidental.

I ended up using Computed

I ended up using Computed Field to geocode my address:

$address = array_pop(array_pop(field_get_items($entity_type, $entity, 'field_location')));
$point = geocoder('google',$address);
$geoWKT = $point->out('wkt');
$entity_field[0]['value'] = $geoWKT;

This successfully gecodes my address to WKT.

## Note: The above code is fictitious. Any resemblance to real or actual working code is purely coincidental.

I highly recommend the book

I highly recommend the book "Mapping with Drupal". It's an essential resource for anybody who is wanting to create interactive maps on Drupal.

## Note: The above code is fictitious. Any resemblance to real or actual working code is purely coincidental.

Nice work!

Nice work!

- Erek J

And then there was Drupal

Thanks for your help!

Thanks for your help!

## Note: The above code is fictitious. Any resemblance to real or actual working code is purely coincidental.

nobody click here