Broadstreet blog

Drupal Location Module - Changing to Locative Information from a CCK Field

← All blog posts
Drupal Location Module - Changing to Locative Information from a CCK Field

Recently I've had to do this.  I create a Drupal Content Type using the Location Module and GMAP Module,   I created a Location CCK field and started entering (or importing) location data into the field.

Afterward, I realized that I did not really want a CCK Location Field.  Instead, I wanted to set the Locative information on the configuration page of my content type.  I did NOT want to re-key my location information, and it turns out I didn't need to.  

When you key in Location data to a location CCK field, the Location data is stored in the Location table.  It is stored in the same place when you use locative information.  The only difference is the data that is stored in the Location_Instance table.  Instead of storing a reference to the for a CCK field in genid, it stores the node id in the nid and vid fields.      

I ran the following query to take the node id from the rightmost characters of the genid and use them for the node id, and blank out the genid.  Worked like a charm... 

UPDATE `location_instance`

SET `nid` = right(`genid`,3),

   `vid` = right(`genid`,3),

   `genid` = ''

More from the blog

September 5, 2009

Indian Trail Golf Course - Nice Drupal Site

I wanted to get a tee time for golf a couple weeks back so I Googled Indian Trail Golf Course in Leesville, SC. It's a decent course, close to home, and…

July 23, 2009

What is Drupal? (in 57 seconds...)

Drupal is free, open source software that can be used to easily create and manage various different types of Web sites. The Drupal application includes a…

Let’s get your phone ringing

Book a free, no-pressure consultation. We’ll review your website and Google presence and show you where you can grow.

Call nowFree consult