Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-07-21 18:53:45

adr
New Member
From: US East Coast
Registered: 2006-07-21
Posts: 7
Website

Display articles on a Google Map

On my thesis website, most of the articles are associated with some geographic location. I used Textpattern to plot every article on a Google Map “mashup.” There are no plugins required here; I built the map using a JavaScript, custom fields, and a few page and form templates. Data are generated on-the-fly, so the map will be updated automatically as I add new articles.

http://davidramos.org/thesis/projects

I store latitude and longitude information for each article in custom fields. The map goes in its own section, with its own page template, along with a JavaScript that draws the map. The JavaScript then pulls in XML data about each article from a a second hidden section.

I wrote up a first draft of a tutorial on how to do this:

http://davidramos.org/thesis/google-maps-in-textpattern

Note that the method I used is a relatively complicated one. It suited my needs well, but instead one could specify the map points in a JavaScript, then use TXP to create the script dynamically.

Last edited by adr (2006-08-02 17:40:03)

Offline

#2 2006-07-22 17:05:25

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,152
Website GitHub Mastodon Twitter

Re: Display articles on a Google Map

this is very cool adr. Will be studying your tutorial soon

Last edited by colak (2006-07-22 17:05:57)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2006-07-24 12:15:30

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: Display articles on a Google Map

Thanks for the very clear tutorial.

I already had the API key, so it only took me around 15 minutes to have my first map up with my home marked on there.

Now I just want to do a little tweaking of the default styling of the google map, and I think I’ll start populating it with some more locations.

Absolutely brilliant! And to think that I was going to try to figure this out on my own …

Offline

#4 2007-08-17 23:10:06

mwillse
Member
From: brooklyn, ny
Registered: 2006-06-26
Posts: 83
Website

Re: Display articles on a Google Map

this is great. ADR, you mentioned that you used an external xml file, but I didn’t see that described in your instructions anywhere. what’s in the xml file? and did you skip its use for this tutorial?

also, have you learned anything new since originally writing this? any additional advice?

thanks!

Last edited by mwillse (2007-08-17 23:10:57)

Offline

#5 2007-09-01 03:23:35

szac
Member
From: Detroit-ish
Registered: 2004-09-18
Posts: 50

Re: Display articles on a Google Map

Step 5 is about the xml. He’s layed out a texpattern page and form to be the xml.

Offline

#6 2007-09-02 15:00:44

guiguibonbon
Member
Registered: 2006-02-20
Posts: 296

Re: Display articles on a Google Map

This is brilliant!! There’s this project that has been lingering in my head that needs to do just that. Didn’t know if if was possible. I’m so excited now! Great job!

I’m wondering though, would it be possible to do this with an address in the custom field instead of coordinates?

Offline

#7 2007-09-07 01:21:07

szac
Member
From: Detroit-ish
Registered: 2004-09-18
Posts: 50

Re: Display articles on a Google Map

Rob Sable’s rss_google_maps plugin uses addresses to show location on the map.

From option 2 of the plugin help:

1. You designate which custom fields in an article contain address data. By default, custom fields 1 – 4 are used.
2. Set the address fields in a new article.
3. When the plugin is called, the addresses are looked up using the Yahoo! Maps geocoding service.
4. If the location is found, the coordinates are added to the Google Map display using the Phoogle Maps PHP class.

Offline

Board footer

Powered by FluxBB