Show/Hide Map Layers
By default, Chart FX Maps are displayed along with their territorial neighbors, bathymetry (ocean depths), major cities, inland waters and, in some cases like US maps, major roads. These map layers have been specifically designed and optimized so they do not interfere with the main intent of visualizing data and allow for richer mapping applications.
These layers can be turned on/off with a simple API call which makes the process of customizing your application’s aesthetical layer even easier.
//This code assumes have already created a map named map1 and hides both the bathymetry and major city names from the map. var contextmapLayer; var oceanmapLayer; var citymapLayer; var mapLayers = map.getLayers(); contextmapLayer = mapLayers.find("@context"); oceanmapLayer = mapLayers.find("@ocean"); citymapLayer = mapLayers.find("@city"); contextmapLayer.setVisible(true); oceanmapLayer.setVisible(false); citymapLayer.setVisible(false);
Map layers are identified in the data dictionary file (.txt) that accompanies every cmf file. In addition, all map layers are listed in a specific drop down box in the file properties when using the MapShellExtension for Windows, as depicted in the following picture: