Wednesday, July 27, 2011

Geo-location based content (content development)

In this part of the coverage of Hippo CMS Google Maps plugin I will show how to use the plugin when designing content types using Hippo CMS.

Btw, If something is not clear the source code also contains a demo project with a document that is already geo-tagged.


First of all, in order to use the plugin we need to have the dependency added to your cms project pom:

Keep in mind to use the latest available version (which is 1.0 at the time of writing).
In order for the plugin artefact to be resolved you can either build it and put it in your repository or fork the project and add it directly to your reactor pom as a module.

Document type

Once the dependency is added the plugin is ready to be used with Hippo CMS. The plugin offers custom compound type called 'Location'. The Location component can be added to the desired document type by selecting Location compound type on the Compound Field panel in the document type editor:

Upon selecting the Location component it will be added to the document type:

The rendering is done by the plugin itself while the structure is kept in the compound type. The location component contains some of the default values, such as latitudelongitude and zoom level.
When the document type is updated with the Location component it is possible to tag documents of that type with GPS coordinates.

Geo-tagging the documents

When opening document for editing the location component will be rendered by the plugin in the same fashion as shown above. Except that the data that is stored in the Latitude, Longitude and Zoom fields will be stored with the document.

The following is typical scenario how a document can be tagged with gps-location:

Let's say we want to tag current document with the location of Amsterdam. For that we could of course lookup the GPS coordinates of the city and manually put those values into the location fields.
Another possibility is to use the Search field which is only used for searching and does not store any values with the document. The plugin tries to find possible matches with as you type:

Once the desired match is selected the map automatically jumps to that place. All is left to do is to choose the right zoom level and click on the map to place a marker:

When the marker is being placed its' coordinates together with the current zoom level are recorded in the location fields:

That's it - the document is tagged! Upon saving (and closing) the document all stored location values (together with a static piece of map) will be displayed along with the rest of the document content:

In the next article I will show how to use that information on your website.

Saturday, July 23, 2011

Geo-location based content (Intro)

The deeper we go into the mobile age the more location based services surround us. Content management systems also have to keep up. In the end - location based-content always follows the location based services.
Being open source enthusiast I am using Hippo CMS for one of my hobby projects where I need to have the ability to tag content with GPS coordinates so that I could use, for example Google Maps, to show how the content is related to a certain place.

While it's certainly easy to assign a couple of meta-data fields to an article it is far from easy to find the desired coordinates and then manually enter add to the content considering you may have thousands of articles! The problem  is  was that those are exactly the requirements I needed! Coming from this an idea for an interactive CMS plugin that would make the editors' live easier was born!

First things first - I was looking for something that might already exist. Unfortunately, I couldn't find anything that was operational.
Eventually - after several evenings of coding and troubleshooting -  the initial version of the Hippo CMS Google Maps plug-in was ready and hosted on github.

In the next blog post I will show how to use the plugin on website (where the content is published) and on the CMS front-end (as content developer and author).