XML Template
[/ezcol_1half] [ezcol_1half_end]
JSON Template
[/ezcol_1half_end]The output of CMaps Analytics Designer is a .CMAP file, often referred to as a “template” file which serves multiple purposes:
1. Metadata file: First and fore-most, CMaps Analytics Designer is a metadata generator. As you select properties, it dynamically creates the metadata which ultimately exists as your .CMAP template. This metadata can be used with CMaps Analytics JS API to dynamically bootstrap and build a map.
2. Project: A .CMAP template that is exported from CMaps Designer can be imported back into the app at any time. A .CMAP file ultimately becomes the project file that your map designer uses to update, upgrade, and modify the map properties as business requirements change. CMaps Analytics JS API is designed to be backwards compatible with older versions of .CMAP files.
Every property in the template file is available and accessible via CMaps Analytics JS API.
The CMaps Analytics Templates are generated and imported to and from CMaps Analytics Designer. The goal of using CMaps Analytics templates is to alleviate all of the common design and repetitive development tasks. The result is a decrease in development time, code to manage, and improve life-cycle management.
How to Create a .CMAPÂ Configuration File
Inside of CMaps Analytics Designer, click Save & Export > then select a JSON or XML based CMaps Template.
How to Import a .CMAP File
From the initial CMaps Analytics Designer screen, click “Import and Edit”
How to Embed a Map with a .CMAP File
With a .CMAP file, you can either embed the contents or link to a .CMAP file. With only a few lines of code you can dynamically build your map and start hooking your data up within minutes.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
//Load CMaps JS API //<script src="https://api.cmapsanalytics.net/mapview?version=3"></script>
<script type="text/javascript">// <!
//CMaps Template
var mapCfg = '<mapView createdBy="name:cMapsAnalyticsDesigner;version:3.0" createdOn="7/21/2016"><viewName>My View</viewName><viewDescription></viewDescription><tags></tags><templateVersion></templateVersion><key>DESIGNER_KEY</key><googlePremierKey></googlePremierKey><sslEnabled>false</sslEnabled><dynamicZoomEnabled>true</dynamicZoomEnabled><currentLocationOnLoadDisabled>true</currentLocationOnLoadDisabled><panCoords></panCoords><zoomLevel></zoomLevel><dynamicZoomOnShapeSelect>false</dynamicZoomOnShapeSelect><dynamicZoomOnClusterSelect>false</dynamicZoomOnClusterSelect><dynamicZoomOnPointSelect>true</dynamicZoomOnPointSelect><showBreadcrumbsOnDrill>true</showBreadcrumbsOnDrill><dynamicZoomOnDrill>true</dynamicZoomOnDrill><multiSelectEnabled>false</multiSelectEnabled><adhocPanelVisibility>false</adhocPanelVisibility><radiusMeasureUnit>km</radiusMeasureUnit><indoorEnabled>true</indoorEnabled><useAdvancedInfowindow>false</useAdvancedInfowindow><includeAdvancedInfWinSummaryCard>true</includeAdvancedInfWinSummaryCard><includeAdvancedInfWinFilterCard>true</includeAdvancedInfWinFilterCard><includeAdvancedInfWinSearchCard>true</includeAdvancedInfWinSearchCard><includeAdvancedInfWinExportCard>true</includeAdvancedInfWinExportCard><includeAdvancedInfWinDriveCard>true</includeAdvancedInfWinDriveCard><includeAdvancedInfWinDrillCard>true</includeAdvancedInfWinDrillCard><includeAdvancedInfWinSelectCard>true</includeAdvancedInfWinSelectCard><includeAdvancedInfWinStreetViewCard>true</includeAdvancedInfWinStreetViewCard><includeAdvancedInfWinHelpCard>true</includeAdvancedInfWinHelpCard><advancedInfoWindowJsonCfg></advancedInfoWindowJsonCfg><infoWindowFontFamily>Arial</infoWindowFontFamily><infoWindowFontSize>12</infoWindowFontSize><infoWindowFontColor>000000</infoWindowFontColor><infoWindowFontAlign>left</infoWindowFontAlign><infoWindowUseBoldFont>false</infoWindowUseBoldFont><infoWindowFontUnderlineEnabled>false</infoWindowFontUnderlineEnabled><infWinItalicFontEnabled>false</infWinItalicFontEnabled><infoWindowVisibility>true</infoWindowVisibility><infoWindowValueVisibility>true</infoWindowValueVisibility><infoWindowLayerNameVisibility>true</infoWindowLayerNameVisibility><glowVisibility>true</glowVisibility><glowColor>0000ff</glowColor><baseMapImageryStyleType>styleTypeRoadmap</baseMapImageryStyleType><showTrafficLayer>false</showTrafficLayer><showTransitLayer>false</showTransitLayer><showBikelayer>false</showBikelayer><legendVisibility>false</legendVisibility><clusterToggleControlVisibility>false</clusterToggleControlVisibility><navigationControlVisibility>true</navigationControlVisibility><currentLocationControlVisibility>false</currentLocationControlVisibility><mapReady>true</mapReady><layerSelected>false</layerSelected><zoomChanged>false</zoomChanged><centerChanged>false</centerChanged><reverseGeocodeResponse>false</reverseGeocodeResponse><latLngToReverseGeocode></latLngToReverseGeocode><geocodeResponse>false</geocodeResponse><addressToGeocode></addressToGeocode><visible>true</visible><indoorMapVisibility>false</indoorMapVisibility><showPinsForIndoorMapLocations>false</showPinsForIndoorMapLocations><directionPanelVisibility>false</directionPanelVisibility><directionWaypoints></directionWaypoints><currentLocation>false</currentLocation><useFreeApi>false</useFreeApi><layers></layers></mapView>';
var cMap;
function buildMap(){
//creates the map instance
cMap = new centigon.locationIntelligence.MapView();
cMap.onMapReady = function(){console.log('map is ready');}
//applies the config xml
cMap.parseConfigXml(mapCfg);
};
</script>
//build the map on load. You can also use $(document).ready()
//Give your map mapDiv ID
<div id="mapDiv" style="height: 100%; width: 100%; position: absolute; top: 0px; left: 0px;">
Why doesn’t CMaps Designer store templates in the cloud?
Because CMaps Analytics templates are used for management and as part of development projects and extensions, we find most customers want to store development assets within their own source control solution. As CMaps Analytics expands integrations into cloud-based ecosystems we will provide native integrations into secured cloud repositories in the near future.