Geopress to Geotag data migration

Just in case you decided to try other location tagging plug-in for your WordPress today.

I have developed a fairly simple data migration script so that you won’t need to go through the pain of re-adding latitude and longitude for the new plug-in in all your posts.

Essentially, you will need a bit knowledge on how to access your database administration. Typically, you will be using phpmyadmin to manage your WordPress database.

phpmyadmin

Here is how we do it.

  • Go to your phpmyadmin
  • Select your WordPress’s database, by default, it has a suffix/prefix of ‘WP’
  • Click on the SQL tab
  • Then, execute the following queries below.

Run this for its latitude…

insert into wp_postmeta (post_id,meta_key,meta_value) (select p.post_id, ‘_geotag_lat’, format(left(g.coord,instr(g.coord,’ ‘)-1), 5) lat from wp_postmeta p join wp_geopress g on p.meta_value = g.geopress_id where p.meta_key = ‘_geopress_id’);

And, run this query to retrieve the longitude…

insert into wp_postmeta (post_id,meta_key,meta_value) (select p.post_id, ‘_geotag_lon’ , format(right(g.coord,length(g.coord) – instr(g.coord,’ ‘)),5) lon from wp_postmeta p join wp_geopress g on p.meta_value = g.geopress_id where p.meta_key = ‘_geopress_id’);

I have migrated mine successfully. Hope it helps for you too!

Social tagging: > > >
 
  • http://www.blogger.com/profile/07291779402934741470 soo sean

    OMG! You are an expert! I know where to look for help in future. Kekeke.

  • http://www.hugolim.com Hugo Lim

    hahahhaa.. surely surely… will gimme a note when you need help on these fields :P

  • http://www.davidtn.net DavidT

    wahh… dont really get this… any tutorial on how to setup the hosted wordpress blog?

  • http://www.hugolim.com Hugo Lim

    setting up ahh, tutorials about this is wide spread across the giant webby…. try google around!

    in case you are moving from blogspot to wordpress, then you can see my article on it lah!

    http://www.hugolim.com/2008/09/blogspot-to-self-hosted-wordpress-migration

    thanks for commenting ahh!