CMap Installation Notes: Using CMap is designed to be very easy. I will include some code examples of how to use CMap effectively. There is also an online API documentation at: http://www.brybot.ca/software/CMap/docs 1 - Generating Google and Yahoo Maps: 1.1 - Requirements for Google and Yahoo Maps: For in-page maps, we only have two requirements, we need to include the CMap code and have a
container for each map on that page. Aside from that, some online maps require a key or unique identifier to be able to use that particular map. Currently you can get keys at the following pages: For Google Maps: http://www.google.com/apis/maps/signup.html For Yahoo Maps: http://api.search.yahoo.com/webservices/register_application 1.2 - Code Example: A single Google Map
First Location

'); // Add locations to CMap $cmap->addLocation($location1); // Draw the Map $cmap->setContainer("mapContainer"); $cmap->setKey("Key-from-Google"); $cmap->drawMap(); ?> This code will create a 600x500 Google Map with one location. The location's bubble will open upon clicking with the HTML provided. The map will automatically calculate the center and zoom level of the map as well. 1.3 - Code Example: A more advanced Google and Yahoo Map
First Location

'); $location2 = new Location(48.28739597242064, -124.12379002571106, '

Second Location

'); $location3 = new Location(47.28739597242064, -122.12379002571106, '

Third Location

'); $cmap->addLocation($location1); $cmap->addLocation($location2); $cmap->addLocation($location3); $cmap->setContainer("googleMap"); $cmap->setControlSize(SML_CONTROLS); $cmap->setDisplayType(HYRBID_MAP); $cmap->setKey("Key-From-Google"); $cmap->drawMap(); $cmap->setContainer("yahooMap"); $cmap->setControlSize(LRG_CONTROLS); $cmap->setMapType(YAHOO_MAP); $cmap->setKey("Key-From-Yahoo"); $cmap->drawMap(); ?> This will output a Google Map and a Yahoo Map side by side. The Google Map will have a minimized control interface and default to a hybrid view. The Yahoo Map will have normal (or full) control interface. 2. Generating Google Earth KML Files 2.1 Setup CMap is capable of creating KML files to be directly used in Google Earth. It is very simple but the page needs to be set up for it. CMap generates the KML but does not generate any headers to set the MIME-type of the page. Therefore, the correct code is generated but the web browser will attempt to erroraneously parse it (unless you want to do that). We simply need to include 1 or 2 headers in the Google Earth file: header("Content-Type: application/vnd.google-earth"); will set the MIME-type to a Google Earth KML file, and: header("Content-Disposition: attachment; filename=brybot.kml"); will force the user to download the KML file as brybot.kml 2.2 Example Code: Google Earth File Testit

'); $cmap->addLocation($loc); $loc = new Location(49.3441594037696, -123.25507342815399, '

Testit2

'); $cmap->addLocation($loc); $cmap->setMapType(GEARTH_FILE); $cmap->drawMap(); ?> When you link to this php page, it will force the user to download a KML file with your two locations in it and the html in the bubbles. --------------------------------------------- As mentioned before, the full API documentation can be found at: http://www.brybot.ca/software/CMap/docs I welcome any contributors! Send any comments, questions, or BUGS to: Bryan Rite # $Id$