Addressfield with Geofields in Openlayers
A recent comment asked about addressfields, I had no yet used these so I thought it would be a good opportunity to try it out.
Though for people new to Drupal it may seem a little daunting with the number of modules to install and openlayers & views setup so I thought I would put a tutorial together demonstrating a basic implementation of using addressfields in Drupal 7.
For my example I'll be using landmarks in the city of London and entering points of interest to the geofield via the addressfield.
Make sure you do this tutorial first. It will get you familiar with Openlayers & views.
Here's a list of the Drupal 7 libraries and modules you will need
- geophp module
- libraries (use the 2.x version)
Here is the drush command I'll be using to download and enable the modules. Note some of them will be dev versions
drush dl openlayers-7.x-2.x-dev geofield-7.x-2.x-dev geocoder-7.x-1.x-dev addressfield-7.x-1.x-dev geophp views ctools libraries-7.x-2.x-dev
drush en openlayers_views, openlayers_ui, openlayers, geofield_map, geofield, geocoder, addressfield, geophp,views, views_ui, ctools, libraries
- Add a new map to Openlayers
- Create a new content type
- Add a addressfield and geofield to the content type. For the geofield ensure the 'geocode from another field is enabled'
- Now create some content types. I'll be selecting POI's in London
- Create a new view and add the OpenLayers Data Overlayer view. I won't go into details over setting up the display, check the first tutorial for reference
- Once the view has been completed, edit the openlayers map and enable the layer that has been generated by views.
- Go back into the view and add a page display, then enable the Openlayers format and set a path
- That's it, go to your path address and you should now have your dots appearing on a map at the path you specified.
Entering geocode data via the addressfield mechanism seems to be a popular use case and this tutorial hopefully demonstrated this.
There were a number of extra and new modules required to allow the addressfield data to be geocoded through to the geofields but once setup the rest was just the standard openlayers & views configuration, which if you have done the previous Openlayers tutorials will seem very familar
That's all for this one, hopefully you got something out of it and remember don't forget to flush your cache.
- New post: Posting location co-ordinates to a drupal service - Part 2 http://t.co/MQhlVKBNKC — 1 year 3 months ago
- New post: Posting location co-ordinates to a drupal service - Part 1 http://t.co/2xlYgqFaJ0 — 1 year 3 months ago
- New post: Connecting a drupal service with a mobile application - Part 2 http://t.co/01cFtAunDs — 1 year 3 months ago
- New post: Using drupal services to connect to mobile applications - Part 1 http://t.co/VEURftHCef — 1 year 3 months ago
- New post: Creating Drupal 7 video gallery http://t.co/HvpKU7uT — 1 year 5 months ago