Map Channels v4 API Reference

The API Reference is for use when locally hosting your map. Using the API reference you can customize your map features without having to use the Map Edit page.

By default your map is remotely hosted at data.mapchannels.com. You can opt to locally host your map by storing all the Map Channels files required to display the map on your own website.


Local Hosting Instructions

1. Go to the Map Channel v4 Edit Page for your map, then click on the link labelled '1. Embed'.

2. Click the 'Setup Local Hosting' link.

3. Download and extract the zip file (the zip contains 2 files, an HTML file and a data file).

4. Add the extracted files to your website. It is recommended to keep the files in one folder.

5. Edit the HTML file (with the extension .htm) as required using the API reference below.

6. Add code to your web page(s) where you want to embed the map. Use the original iframe embed code from the Map Edit Page and change the src value, replacing the path to the HTML file with the path on your own website.

7. Upload all the files to your web server, load the web page in your browser and the map should display.


Variable List

The variables are listed in the same order as on the Edit Page. Further information about the variables is available on the Edit Page.

Where variables differ from the default value they should be included within the javascript section of the map HTML file.

Information

Variable Name Type Default Value Notes
mc4_mapID string blank The map identifier
mc4_title string blank The map title
mc4_description string blank The map description (optional)

Feed

Variable Name Type Default Value Notes
mc4_feedType string blank the feed file extension, kml = KML, rss = GeoRSS, txt = Tab-delimited text.
Note: feed filename = mc4_mapID + '.' + mc4_feedType

Map Basic

Variable Name Type Default Value Notes
mc4_zoomFit integer 1 0=Off, 1=On. When set, the map centre and zoom level will be set automatically to show all placemarks
mc4_mapX float 0 The initial map longitude, ignored if mc4_zoomFit is set
mc4_mapY float 0 The initial map latitude, ignored if mc4_zoomFit is set
mc4_mapZoom integer 0 The initial map zoom level (0 - 20)
mc4_mapType integer 0 The initial map type, 0=Road, 1=Satellite, 2=Hybrid, 3=Terrain
mc4_placeID string blank If set, displays an info window and centres the map on the place with the specified id value.
mc4_initialStreetView integer 0 0=Off 1=The Street View panorama is initially visible, displaying the street view near to the place specified by mc4_placeID (see above).
Requires (1) a valid Place ID to be specified (2) A Google Street View image to be available near the specified place.

Map Advanced

Variable Name Type Default Value Notes
mc4_panControl integer 0 Pan Control, 0=Off 1=On
mc4_zoomControl integer 0 Zoom Control, 0=Off 1=Default 2=Large 3=Small
mc4_mapTypeControl integer 0 Map Type Control, 0=Off 1=Default 2=Dropdown Menu 3=Horizontal Bar
mc4_scaleControl integer 0 Scale Control, 0=Off 1=On
mc4_streetViewControl integer 0 Street View Control, 0=Off 1=On
mc4_overviewMapControl integer 0 Overview Map Control, 0=Off 1=Yes (closed) 2=Yes (open)
mc4_scrollwheel integer 0 0=Off 1=On, When set the mouse scroll wheel can be used to zoom in and out of the map
mc4_resetButton integer 1 0=Off 1=On, Display a button labelled 'Reset' on the map which will restore the map centre and zoom level when clicked
mc4_printButton integer 0 0=Off 1=On, Display a button labelled 'Print' on the map which will print the map when clicked
mc4_tooltipType integer 0 0=No Tooltip, 1=Simple Tooltip, 2=Advanced Tooltip
mc4_tooltipOffsetX integer 0 horizontal adjustment in pixels
mc4_tooltipOffsetY integer 0 vertical adjustment in pixels
mc4_mapMinZoom integer 0 0=Off, any other value sets the mimimum zoom level which can be selected by the user.
mc4_mapMaxZoom integer 0 0=Off, any other value sets the maximum zoom level which can be selected by the user.
mc4_zoomInLevel integer 0 Zoom Increment, the number of levels that the zoom level is changed by when 'zoom in' or 'zoom out' is clicked.
mc4_mapIconWidth int blank The width in pixels of map marker icons, 0 = use default width
mc4_mapIconHeight int blank The height in pixels of map marker icons, 0 = use default height

Panels

Variable Name Type Default Value Notes
mc4_headerHeight integer 0 The height of the header panel in pixels, 0 = hidden
mc4_headerPlacement integer 0 0 = The header panel is displayed above the map. 1 = The header panel is displayed below the map.
mc4_footerHeight integer 0 The height of the footer panel in pixels, 0 = hidden
mc4_footerPlacement integer 1 0 = The footer panel is displayed above the map. 1 = The footer panel is displayed below the map.
mc4_sidebarWidth integer 234 The width of the sidebar in pixels, minimum value = 234
mc4_textFilter int 1 0=Off, 1=On. Display a filter control in the sidebar labelled 'Search' by default which can be used to filter listings by name
mc4_categoryFilter integer 0 0=No Category Filter, 1=Category Filter displayed in the sidebar, 2=Category Filter displayed in the header panel
mc4_sidebarCoordinates integer 0 0=Off, 1=On. Displays the lat long coordinates in the sidebar
mc4_boundsFilter integer 0 0=Off, 1=On. Only lists places that are within the current map bounds.
mc4_sidebarMapInfo integer 0 Map Information Panel height in pixels, 0=Hidden. Displays map information (the title and description) in the sidebar
mc4_sidebarSortOrder integer 0 Sets the sort order applied to the sidebar index.
0 = Natural Order
1 = Sort by Name
2 = Sort by Category then Name
3 = Sort by Type then Category then Name
4 = Reverse Order (latest listings are displayed first)
mc4_sidebarSwitchable integer 1 0=Off 1=On. If set a button with 2 arrows is displayed on the map which allows the user to hide or show the sidebar
mc4_sidebarVisible integer 1 0=Sidebar is initially hidden, 1=Sidebar is initially visible
mc4_sidebarAlignment integer 0 0 = Left side, 1 = Right side
mc4_sidebarTooltips integer 1 Display a place tooltip on the map when the cursor is moved over a sidebar listing. 0 = No, 1 = Yes
mc4_sidebarBackCol string gainsboro The background colour used for controls on the sidebar (excluding the main place index)

Info Windows

Variable Name Type Default Value Notes
mc4_infoWindowMaxWidth integer 0 The Maximumum Width of the Info Window (0=not used)
mc4_infoWindowWidth integer 0 The Fixed Width of the Info Window (0=variable width)
mc4_infoWindowHeight integer 0 The Fixed Height of the Info Window (0=variable height)
mc4_infoWindowPlacement integer 0 0 = Info Window is anchored at the bottom of the place marker (the actual point)
1 = Info Window is anchored at the top of the place marker
mc4_infoAutoPan integer 1 0 = No, the map centre is unchanged when the info window is opened
1 = Yes, the map centre changes to make the info window visible when opened
mc4_infoTargetFrame string _blank the target used for links, should be one of _blank (opens in new tab of window) or _top (opens in current page)
mc4_infoFieldCategory integer 0 0=Off, 1=On, display the place category in the info panel
mc4_infoFieldStreetView integer 0 0=Off, 1=On. Displays a 'Street View' link in the info window.
mc4_infoFieldStreetViewRadius integer 0 The radius in metres within which to search when loading a street view.
mc4_infoFieldCoordinates integer 0 0=Off, 1=On, display place lat long coordinates within the infowindow
mc4_infoFieldDirections integer 0 0=Off, 1=On, display a link to get directions to or from this place
mc4_infoFieldZoom integer 0 0=Off, 1=On, display a link to zoom in the map centred upon the selected place
infoFieldDualMap integer 0 0=Off, 1=On, display a link to a page displaying a Dual Map (combining birdseye and streetview imagery where available).
infoFieldLocalMap integer 0 0=Off, 1=On, display a link to a page displaying a Local Map.
mc4_infoIconWidth integer 0 The width in pixels of the icon displayed within the info window, 0 = default width
mc4_infoIconHeight integer 0 The height in pixels of the icon displayed within the info window, 0 = default height

Data Schema

Variable Name Type Default Value Notes
mc4_dataFields string 0 List of data fields mapped to column names from the source text feed. Each element is in the format 'field=column' and elements are separated by tab characters ('\t').
The standard data field names are id,x,y,name,description,category,marker and link.
mc4_templateInfoWindow string blank if set, defines the template to use for displaying the info window text section. If not set, the place description is displayed. The template consists of HTML code with variables enclosed by braces, { }.
mc4_templateSidebar string 0 if set, defines the template to use for displaying the sidebar listing text. If not set, the place name is displayed. The template consists of HTML code with variables enclosed by braces, { }.
mc4_templateTooltip string 0 if set, defines the template to use for displaying the tooltip text. If not set, the place name is displayed. The template consists of HTML code with variables enclosed by braces, { }.

Categories

Variable Name Type Default Value Notes
mc4_categories string blank List of category names mapped to marker URLs. Each element is in the format 'category=url' and elements are separated by tab characters ('\t')
mc4_polyLineColour integer FF0000 the colour of polylines and polygon edges in RRGGBB format, e.g. FF0000 is red
mc4_polyLineOpacity float 0.7 The opacity of polylines and polygon edges
mc4_polyLineWidth integer 1 The width in pixels of polylines and polygon edges
mc4_polyFillColour integer FF0000 the colour of polygon interiors in RRGGBB format, e.g. 00FF00 is green
mc4_polyFillOpacity float 0.5 the opacity of polygon interiors from 0.0 (transparent) to 1 (solid)
mc4_defaultMarkerUrl string blank The URL of the marker icon to use when displaying places (optional).

Layers

Variable Name Type Default Value Notes
mc4_layersPlacement int 0 0=Sidebar, 1=Footer Panel. Layer Control Placement: specifies where the layer controls are placed.
mc4_layers string blank A collection of layers, each element consists of name, layer url or fusion table id, marker name, visible, all separated by tab characters (\t). Each element is separated by a linefeed character ('\n')
mc4_layerWeather integer 0 0=Off 1=On, initially hidden, 2=On, initially visible. Shows a layer of current weather conditions.
mc4_layerWeatherTemperateUnits integer 0 0=Celsius, 1=Fahrenheit. Sets the units used for temperature in the weather layer.
mc4_layerWeatherWindUnits integer 0 0=Kilometres Per Hour, 1=Metres Per Second, 2=Miles Per Hour. Sets the units used for wind speeds in the weather Layer.
mc4_layerCloud integer 0 0=Off 1=On, initially hidden, 2=On, initially visible. Shows a layer of current cloud conditions.
mc4_layerTransit integer 0 0=Off 1=On, initially hidden, 2=On, initially visible. Shows a layer of public transport routes and stations.
mc4_layerTraffic integer 0 0=Off 1=On, initially hidden, 2=On, initially visible. Shows a layer of traffic conditions for major roads where available.
mc4_layerBicycling integer 0 0=Off 1=On, initially hidden, 2=On, initially visible. Shows a layer of bicycling routes where available.
mc4_layerPanoramio integer 0 0=Off 1=On, initially hidden, 2=On, initially visible. Shows a layer of photos from Panoramio.
mc4_layerPanoramioTag string blank Applies a tag filter to photos displayed in the Panoramio layer
mc4_layerPanoramioUserID integer 0 Applies a User ID filter to photos displayed in the Panoramio layer
mc4_layerHide integer 0 0=Off 1=On. If enabled, displays a 'Hide Layers' link (when the layer controls are placed in the footer panel).

Search Links

Variable Name Type Default Value Notes
mc4_createMapLink integer 1 0=Off 1=On. If enabled, a link labelled 'Create Map' will be displayed in the header panel which links to the Map Channels v4 page.
mc4_fullPageLink integer 1 0=Off 1=On. If enabled, a link to a full page version of the map will be displayed in the header panel.
mc4_googleSearch integer 1 0=Off 1=On. If enabled, a Google Search control is displayed in the right hand side of the header panel.
mc4_googleSearchWidth integer 200 The width in pixels of the Google Search control.
mc4_geolocationEnable integer 1 0=Off 1=On. If enabled, a 'My Location' button is displayed in the right hand side of the header panel.
mc4_searchEventsEnable integer 0 0=Off 1=On. If enabled, a link to an Events Guide map is displayed on the left side of the header bar.
mc4_searchEventsTitle string blank The title of the Event Search link.
mc4_searchHotelsEnable integer 0 0=Off 1=On. If enabled, a link to a Hotel Search Page is displayed on the left side of the header bar.
mc4_searchHotelsTitle string blank The title of the Hotel Search link.
mc4_searchCustomEnable integer 0 0=Off 1=On. If enabled, a link to a Custom Geo Search Page is displayed on the left side of the header bar.
mc4_searchCustomTitle string blank The title of the Custom Search link.
mc4_searchCustomURL string blank The base URL of the Custom Search link.
mc4_searchCustomLatParam string blank The parameter used to supply the latitude value for the Custom Search
mc4_searchCustomLngParam string 0 The parameter used to supply the longitude value for the Custom Search
mc4_searchCustomZoomParam string 0 The parameter used to supply the zoom value for the Custom Search

Localities

Variable Name Type Default Value Notes
mc4_localities string blank A string containing a list of localities. Each locality comprises 4 fields (name, lat, lng, zoom) separated by \t. Each locality is separated by \r\n
mc4_localitiesPlacement int 0 0=Sidebar (as select control), 1=Footer Bar (as multiple links)

Custom Map Style

Variable Name Type Default Value Notes
mc4_style string blank A collection of rules separated by a linefeed character ('\n') . Each rule consists of feature type, element type, gamma, hue, lightness, invert lightness, saturation and visibility, all separated by tab characters (\t).

Dictionary

Variable Name Type Default Value Notes
Multiple variables, this section is best set up in on the Map Edit page. string blank

CSS

CSS is set directly in the HTML page either in the style section or via an external CSS file. No mc4_ variables are used for CSS.

Adverts

Variable Name Type Default Value Notes
mc4_adsEnabled integer 1 0=Off, 1=On. When set, one or two Google Ad Units are displayed on the map and/or sidebar
mc4_adsPlacement integer 0 0=Map Corner, 1=Sidebar.
mc4_adsenseID string blank Your AdSense Publisher ID.
mc4_adsenseChannel string blank optional, the AdSense Channel used for the ad unit created using mc4_adsenseID (above)








 

 • Open Tour Map  • Team Maps  • Map Channels Events  • Map Channels Hotels  • TripGeo  • Street Cities  • My Maps Plus (c) www.mapchannels.com, 2007-2014   Terms