|
Documentation
This is the official Geo Mashup 1.4 documentation. (Looking for 1.3?) The sidebar lists the main pages, and here is the table of contents for this page:
System RequirementsAs of version 1.4, WordPress 3.0 or higher is required, and PHP 5. If you are running PHP 4, Geo Mashup will throw a fatal error on activation. Geo Mashup is intended to support the same MySql versions as WordPress, but testing resources are limited. Please submit an issue if you believe there's a problem with your version. First Time InstallationGeo Mashup is available in the WordPress Plugin Directory, which means it can be installed directly from the WordPress admin interface under Plugins / Add New. A search for Geo Mashup should work there. Downloading a .zip packageIf you want to download you own package to install, you can get your choice of Geo Mashup .zip packages. Any Geo Mashup .zip package can be installed using the WordPress upload install interface, also under Plugins / Add new. This won't work, though, if you already have a version of Geo Mashup installed. If that's the case, WordPress 2.9 at least requires one of the following alternate installation methods. FTP or other upload method
ActivationAfter any install, you'll have to activate the plugin (from the plugins list if you're not prompted). You should then go to Settings / Geo Mashup to configure it. UpgradingIf you've upgraded in the past year or so, the same method you used should work again. Otherwise, look over the UpgradeConsiderations to see if they'll affect you. You can upgrade to a new stable version right from the Plugins list via the "upgrade automatically" link. This will delete files you've created in the geo-mashup folder. Most users won't have to worry about this, but if you have created or edited files in the geo-mashup plugin folder, see UpgradeConsiderations. To install beta versions, use the FTP or other upload method installation instructions above. Getting StartedGeo Mashup lets you save location information for various "objects" such as posts, pages, users, and comments. You can then put these objects on maps in posts, pages, or just about anywhere else on your site. Map ProvidersGeo Mashup uses the mapstraction library to offer a choice of map providers. Visit the Geo Mashup settings to choose one in the Overall tab. Your choice has some consequences:
Save locations for things like postsBy default Geo Mashup won't show a map unless there is something like a located post to put on it. It's most common to save locations for posts and pages, but Geo Mashup can also save locations for custom post types, users, and comments. You can choose which of these you want to collect location for in the Overall settings - the default is posts and pages. When adding or editing a post or paage, a Location area has been added near the bottom of the editor page:
You can drag the location area closer nearer to the top of the page if you like. Click in the Find Location textbox and type a place name (like Chartre in this example) to do a search:
Notice the help link next at the bottom. Clicking this will display the instructions for other ways to search for a location. The location that will be saved is marked with a green pin. If there's already a location saved, you can change it or delete it. Add a MapYou can put a map in any page or post by typing the shortcode [geo_mashup_map] into the editor. Look at the TagReference for more options. Single MapIf the post or page has a location, the map displays a Single Map showing only that location. Global MapIf the post or page has no location, a Global Map of all located posts and pages is displayed. Contextual MapYou can put a map outside posts and pages by using the template tag <?php echo GeoMashup::map(); ?> to make a Contextual Map that shows the located items listed nearby. (Technically contextual maps include located items in the current global query results - usually that's the main list of posts, or the page being viewed). The TagReference has details for template tags. What's NextNow your imagination might go wild with the possibilities. Skim the rest of this page to see what's here. You might want to look at the user-contributed guides for ideas. When you're ready to add your map shortcodes and tags, look at the TagReference to see how far beyond a simple [geo_mashup_map] or <?php echo GeoMashup::map(); ?> you can go. If you need help, you can offer to pay an amount of your choice for expert help at WP Questions, or post in the free Google Group. Please submit an issue if you run into problems, or would like to request a feature. Geo Mashup SettingsFind these in the WordPress administration area under Settings / Geo Mashup. You can get an overview of some Geo Mashup features here with brief descriptions. Using FeaturesThese are some of the common things you can do with Geo Mashup. Global Mashup PageYou can have a single page with a global map that will be the target of links generated by Geo Mashup. Create a page, include the [geo_mashup_map] shortcode in it, and select the page in the Settings / Geo Mashup / Overall / Global Mashup Page dropdown list. The "Show on Map Link" tag and "Add Category Links" options will now create links to this page, which will load a global map appropriate for the link. Auto ZoomZoom levels can be set to 'auto', in both settings and tags. The zoom level is calculated to show all the content on the map. A consequence of this is that the content must first be added to the map before the final zoom level is set, and this operation may be visible when the map loads. Save a location by uploading a KML AttachmentInstead of searching for a location in the location editor, you can upload a KML file attachment with a post or page using the "Add Media" button on the editor (see screenshot). Once uploaded, you can insert a link in your post or just close the upload window. The geographic center of all features in the KML file will be used to determine a default location for the post or page.
Note: Google maps can only load KML files that are accessible to its servers, so a KML attachment on a private domain (e.g. localhost) or site will not work. Displaying a KML fileOnce a page or post has a KML file attached, that file will be loaded in a single map. You can also display KML files associated with the selected marker on a global map by checking "Show Geo Attachments" in Settings / Geo Mashup / Global Maps, or setting the marker_select_attachments parameter of the map tag to "true". Creating a KML fileYou can create a map in the My Maps tab of the Google Maps page and save it as KML using these instructions. Add a "show on map" link to posts with a locationYou can add a link from any located item to your designated global map page, with the global map centered on the clicked item. Use the [show_on_map_link] shortcode tag for a single item, or the template tag <?php echo GeoMashup::show_on_map_link(); ?> to add links to all posts or pages. See the TagReference for details. Customize the info window and other contentThe content in the info window is generated by a template that works just like any other WordPress template. Geo Mashup comes with a default template found in default-templates/info-window.php that generates content similar to prior versions. Don't edit this, but you can copy it to geo-mashup-info-window.php in your theme directory, and your custom template will be preserved in future upgrades. There are templates for other types of info window content that can also be customized by copying to your theme folder:
You can also change the styling of the info window and other map components, copy css/map-style-default.css to map-style.css in your theme folder to get started. WordPress Background: Templates and Template Tags WidgetsGeo Mashup doesn't create new widgets, but you can use Geo Mashup shortcodes in a standard WordPress text widget. See the TagReference for shortcodes. More Feature Resources
APIs For DevelopersI've been customizing Geo Mashup for my clients for years, and have developed decent APIs along the way to do it. Contact me via this site or my site and I'll work with you. Or let me know why you won't use Geo Mashup, or why I should use something else. We developers don't talk enough, and this has resulted in a fragmented bunch of tools, none of which are as good as what we could make together. Talk to me! Custom JavaScriptJavaScript allows marker customization and other fine control over map behavior. You'll install and activate the Geo Mashup Custom plugin. This plugin will never be upgraded, and so provides a safe place for your edited files. Custom javascript code can be saved in a file called custom.js in the geo-mashup-custom plugin folder. See UpgradeConsiderations for details about why a separate plugin is used - it protects your code from being overwritten by Geo Mashup upgrades. If you need icon images, check out the Google Maps Icons project. JavaScript and map providersUntil version 1.4, Geo Mashup used only v2 of the Google Maps API for maps, and custom javascript would be written only for that API. Version 1.4 still supports that API, but uses the Mapstraction library to enable more map providers, and now custom javascript can be written for Mapstraction or even tailored to specific map providers. So if you have Geo Mashup javascript customizations for Google v2, they may not work with a new map provider. Calls to the Google Maps API v2 need to be replaced with calls to the mapstraction API. The key changes are:
To help keep custom javascript small and specific to a particular provider API, Geo Mashup loads the custom javascript file according to this file name scheme: custom-<provider>.js Where <provider> is currently google, googev3, or openlayers. If that doesn't exist, but the provider is not google, this file is used for general Mapstraction customizations: custom-mxn.js And if that is not present or appropriate, the original is loaded: custom.js JavaScript APIThe API is based on an event interface that invokes callback functions for named actions. As an example we'll use the 'loadedMap' action to add a Flickr layer of squirrel pictures to the map. If you're targeting the old Google v2 map provider, this code could go in a file named custom-google.js:
// An Example Google Maps API v2 customization
GeoMashup.addAction( 'loadedMap', function ( properties, map ) {
var kml;
// Load some KML only into global maps - for instance pictures of squirrels
if (properties.map_content == 'global') {
// Make the Google Maps API v2 calls to add a Flickr KML layer
kml = new google.maps.GeoXml("http://api.flickr.com/services/feeds/geo/?g=52241987644@N01&lang=en-us&format=kml");
map.addOverlay(kml);
}
} );
Any other map provider can be targeted in a custom-mxn.js file, but it will only work if the provider supports the features used:
// An Example Mapstraction customization
GeoMashup.addAction( 'loadedMap', function ( properties, map ) {
// Load some KML only into global maps - for instance pictures of squirrels
if (properties.map_content == 'global') {
// Make the Mapstraction call to add a Flickr KML layer
// This will only work with a provider that supports it (googlev3 does, openlayers doesn't)
map.addOverlay( 'http://api.flickr.com/services/feeds/geo/?g=52241987644@N01&lang=en-us&format=kml' );
}
} );
All of the Geo Mashup methods and action events are listed in the JavaScript API reference. There are more examples in user wiki guides. It can also be very useful to view the source of the custom javascript files of the author's projects and the user ExamplesInAction. Dependent PluginsThere are good possibilites for plugins to make use of Geo Mashup data. Geo Mashup Search is an example. If you need a Google API Key in your plugin, you can get Geo Mashup's with this PHP code: $google_key = get_option( 'google_api_key' );. This setting is not deleted if Geo Mashup is uninstalled. PHP ReferenceGeo Mashup provides some WordPress filters documented in the FilterReference. This version has complete inline PhpDoc documentation, which allows for generated documentation. Known Issues and General HelpDomain Name and API KeyThe domain name you use to register your API key for the Google v2 provider can be important. If you are getting an API key error, this may be the reason. Your domain name (cyberhobo.net, for me) is important to this plugin in a few ways. The most common issue is that most websites will work with either the bare domain name (http://cyberhobo.net), or with a www. prefix (http://www.cyberhobo.net/). This plugin will not work with both names unless you follow these guidelines:
Help, Questions, and Troubleshooting
| |
Yes, I would love the option of being able to control how much content is displayed with the more tag too.
I've updated to the latest version of the plugin, and I notice that while all the categories are set to aqua, some in the map are white, almost like text balloons. What do these mean?
Thanks!
There are special icons for markers with multiple posts (a plus sign), and multiple categories (a rainbow).
hello, how can I show map on the blog all the time? i have tried the <?php echo GeoMashup?::map(); ?> but this is even wrong, the correct magical sentence is <?php echo GeoMashup?::the_map(); ?>. this code help me show the map but only when i see the given page form admin area ;( I run the wordpress 2.6. any suggestions?
thanks a lot Jan
Jan - what version of Geo Mashup do you have? I believe the documentation is correct for 1.1.1, but the_map() was present in previous versions.
correction... that was my fault indeed. I have the old version. I think it would be helpful if you mention in the text that the new version has different tag.
thanks ;) Jan
I've added a note to that effect in the TagReference.
Hey folks - please feel free to leave comments about the documentation here, but if you need help you'll do better at the discussion group. Thanks!
Hello, How can I change the language of all the controls of the maps? My blog is bulgarian, so I would like all the controls of the maps to be in bulgarian too. Thanks!
The maps should use the language set in the browser, when supported. Unfortunately it looks like the API may not yet support Bulgarian.
Hello again, I tried to add "hl=bg" to the script tags and it worked perfectly. Thank you very much for your help!