« GeoSpatial Simple 1.0 | Main

June 04, 2008

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54fa7efe7883300e552a9d2148833

Listed below are links to weblogs that reference Version 1.1:

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Thanks Bryan! Works like a champ now!

Jonathan Rawles

Thanks! It works with my database now. I'm still doing set up, but it looks good!

Jonathan Rawles

It does work. Thank you!

drawfire

Great work, Bryan! I'm a MT n00b but got this installed without any hiccups on 4.1.

I'm not confident that I understand how to use the various tags but is there a way to include a track or breadcrumbs between two points on the map? My wife and I are moving across the country and would like our friends and family to be able to see where we are and where we've been during the trip.

Bryan Tighe

@drawfire - Yes, a map like that is definitely possible, although you'd use the Google Maps API (in javascript) to do this. If you follow section C of the instructions to make a map with all of the map points, then it would not be too much work to make lines that go from the first point to the next, and so on.

I really recommend you read the Google Maps API documentation (http://code.google.com/apis/maps/). The tags for the GeoSpatial plugin are fairly simple and give you the locations, but with some extra javascript you can do a lot more.

drawfire

Bryan, thanks so much for the prompt reply. I've come to realize that I'm way out of my depth here. Everything appears to be okay except that I can't seem to get a map to appear in any posts... just the title and text of the entry. I'm guessing this is an issue with template modifications (?).

I've got the header modified, and all the right fields show up in the "create post" page. Could you give me a hint on which template to modify so that I can get maps to display on the main page?

TIA

Bryan Tighe

@drawfire - If you want maps to appear for a post, then you can insert the proper tags into the Entry Summary and Entry Detail templates. (Entry Summary is used for displaying posts on the main page, and Entry Detail is used when you're viewing a post by itself.) Or, you could put the map tags in the Metadata template, because this is included by both the Entry Summary and Entry Detail templates.

If you want to make a map with all of the locations on it, then you will need to modify the Main Index template (assuming you want your map on the front page), or you can make another template just for the map and link to it from the front page.

Does that make sense? If you need more help on managing templates, I would suggest the movable type support forums.

-Bryan

drawfire

Bryan, thanks again! That got me on the right path and I think I can figure it out now. Thanks very much for your patience.

Vince

Hi, Great Plugin

Having problems running in a multi-blog environment. I have several blogs with different urls. The plugin shows up only in the system overview, and only allows one google api key. I also get nuisance alerts when I am creating entries on different blogs that the api key is not correct. Is there a way to install the plug in so that it only applies to one instance of the blog?

Thanks again

Bryan Tighe

@Vince,
Sorry, right now it only works for all blogs instead of on an individual blog basis. If you understand perl, you're welcome to hack the plugin to get this to work. I'll look into making this change soon.

(Google's API Key will continue to give you an error if it sees a different URL than the one you registered with.)

Charles S

Bryan,

This seems like a very nice plugin. I am running into a problem and I'm wondering if you have any advice on this.

I would like to overlay a non-standard map in all of the map displays in my web-site. I have a .kmz file which includes the map image, and I modified the function initialize_$id
to:

function initialize_$id() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas_$id"));
var geoXml = new GGeoXml("http://knownworld.theennead.com/kmz/map.kmz");
map.addMapType(G_PHYSICAL_MAP);
map.setCenter(new GLatLng($lat, $lon), $zoom);
map.setMapType($display);
map.addOverlay(geoXml);

adding the "var geoXml ..." line and the "map.addOverlay(geoXml);" line. I would expect this to overlay the contents of the kmz file, but it doesn't.

Here is an example test page: http://knownworld.theennead.com/things/archives/test_map.php
Here is the kmz file I am using: http://knownworld.theennead.com/kmz/map.kmz

Any thoughts on whether there is anything about the way that the plugin handles this that I am missing would be greatly appreciated.

thanks,

Charles S

Charles S

Never mind on the previous comment. The google maps api doesn't support .kmz, just .kml, so that is why my previous attempt failed.

Now that I have things working, I have a different question. The pop-up balloon doesn't seem to resize to match the balloon text. Is there some way to fix this? Also, hypertext links within the bubble text fail to work properly because of the lines:


$bubble =~ s/'/#39;/gi;
$bubble =~ s/"/#34;/gi;


in the subroutine geospatial_showmap.

Commenting out those lines allows hyperlinks to work properly, and I'm not seeing what bugs or security holes those substitutions protect against. Am I missing anything?

Thanks.

Bryan Tighe

Charles S,
You can probably find the ability to resize the balloon text in the google maps documentation. However if the text is large, there is a limit to the size of the balloon, so it may overflow no matter what you do if your text is too long.

And you're right, these lines should be removed:
$bubble =~ s/'/#39;/gi;
$bubble =~ s/"/#34;/gi;

and replaced with:
$bubble =~ s/"/\\"/gi;
$bubble =~ s/'/\\'/gi;

The reason the first lines were there was to make sure that any bubble text that contained an apostrophe or quotes would work in the javascript (because the bubble text is loaded through javascript). The fix will make all html tags work, since many tags use quotes such as the a tag. Sorry about that, I guess I overlooked it.

Mike

I should have posted this here, rather in the other post, since I was using version 1.1. Sorry.

After I install the plugin, enter the Gmap api, and then put the one tag in the header, I get this error.

Smarty error: [in evaluated template line 12]: syntax error: unrecognized tag 'mtgsheader' (Smarty_Compiler.class.php, line 580)

This is using MT4.2. Help?

Bryan Tighe

This plugin hasn't been tested in dynamic mode (which is what you're using if you get PHP errors). Can you post a link to your blog so I can check it out?

Mike

Blog isn't public. I'll try with static pages and let you know. (You're right -- I am, in fact, using dynamic pages.)

Mike

Yep, that was it! Thanks. I just needed to switch to static pages.

Mike

One last question. Can't figure out how to get the zoom/direction display on a map that has all entries. (It's easy to do for individual entry maps, but don't see code for maps with every entry on it.)

Bryan Tighe

Mike - You'll have to do that in javascript, there's no MT plugin code that does it. I highly recommend that anyone attempting to do more than the basic mapping stuff with this plugin read the Google Map API docs: http://code.google.com/apis/maps/ .

You could add the map controls like this, for example:
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

Jason

Hi Bryan,

Great plugin. One minor issue: I noticed I get XHTML transitional validation errors on pages where I choose to include a map pik, but not on pages where the map pik is hidden.

Here's a comparison:
http://www.jasoncook.com/2008/07/rome-da-baffeto-tonino.html
(no pik, validates OK)

http://www.jasoncook.com/2007/04/egg-hunt.html
(includes pik+description, doesn't validate)

Also, I'm not sure if this is just me, but when doing a backup of my site in MT, I always get the following error:

Backing up GeoSpatialSimple::Location records: There were no GeoSpatialSimple::Location records to be backed up.

Any idea why that's happening?

thx
Jason

Mike

I'm having a very weird problem. Code was working fine. Now it's not, and code didn't change. The map is completely invisible. However, I've made some adjustments to get it to show up partially, which I'll describe below.

http://www.seiu.org/vote2008/index.php

One thing the code did/does was say category="gotv 2008" for mt entries. Again, this was working fine until a few days ago. Now the only way I get the map to appear AT ALL is to say lastn="30." (or lastn="20" lastn="25" etc) However, there are more than 30 entries in the category, so that's not a solution. If I say lastn="31" (or more), then the map is blank... which is same thing that happens if the lastn is taken out completely.

Thoughts?

Mike

And I've tried deleting the 29th, 30th, and 31st item. So it's not something specific to an entry, I don't think.

Mike

Figured this out. I used an apostrophe in the title, which messed with the JavaScript.

Bryan Tighe

Mike, I'm glad you figured it out. As for the apostrophe thing, if you look up to a comment I wrote to "Charles S" about his similar problems, you'll see a solution. I haven't had a chance to release another version of the plugin with this fix yet, though. Thanks for using the plugin!

ivan

Bryan,

I'm having an interesting issue where I have multiple maps being displayed on newer posts.

On my first post, (I display map in the sidebar), it shows the correct map for the post.

On the second post, map for first point and map for second post are displayed.

On the third post, three maps for three points are being created.

The code I'm using in my template is:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Blog powered by TypePad

Donate $

If you like it

Tip Jar