HTML5 API Reference
Contents
Reference
AVENZA.initialize()
Sets up the HTML5 map viewer library for the current web browser. Should be called once before any calls to AVENZA.embedViewer.
<script> 
    var avenzaViewer = null;
    $(function () {
        AVENZA.initialize();
        avenzaViewer = AVENZA.embedViewer({
            id: 'map_container',
            prefixUrl: 'index_data/'
        });
    }); 
</script>
Arguments
None.
Return
None.
Since
9.1
AVENZA.embedViewer(viewerParams)
Inserts a viewer widget inside the DOM element with the specified id.
 <script> 
     var avenzaViewer = null;
     $(function () {
        AVENZA.initialize();
        avenzaViewer = AVENZA.embedViewer({
            id: 'map_container',
            prefixUrl: 'index_data/',
            layerList: AVENZA.QUAD.BOTTOM_LEFT,
            searchBox: AVENZA.QUAD.TOP_RIGHT,
            searchBoxPlaceholderText: "Enter county name to search"
        });
     }); 
 </script>
Arguments
Return
A reference to an AVENZA.Viewer object for the newly embedded viewer.
Since
9.1
AVENZA.Viewer
AVENZA.Viewer.panRight()
Pans the viewer horizontally to the right.
<button type="button" onclick="avenzaViewer.panRight()">Right</button>
Since
9.1
AVENZA.Viewer.panLeft()
Pans the viewer horizontally to the left.
<button type="button" onclick="avenzaViewer.panLeft()">Left</button>
Since
9.1
AVENZA.Viewer.panUp()
Pans the viewer vertically upwards.
<button type="button" onclick="avenzaViewer.panUp()">Up</button>
Since
9.1
AVENZA.Viewer.panDown()
Pans the viewer vertically downwards.
<button type="button" onclick="avenzaViewer.panDown()">Down</button>
Since
9.1
AVENZA.Viewer.panHome()
Sets the viewer to the viewport defined in the viewer options.
<button type="button" onclick="avenzaViewer.panHome()">Home</button>
Since
9.1
AVENZA.Viewer.zoomIn()
Zooms the viewer in.
<button type="button" onclick="avenzaViewer.zoomIn()">+</button>
Since
9.1
AVENZA.Viewer.zoomOut()
Zooms the viewer out.
<button type="button" onclick="avenzaViewer.zoomOut()">-</button>
Since
9.1
AVENZA.Viewer.setVisible(layerName, visible)
Sets the visibility of the specified layer.
avenzaViewer.setVisible("SubwayStations", false); 
Arguments
Since
9.1
AVENZA.Viewer.panToPointAndZoom(location, zoom, immediate)
Centers the viewer to the location {x,y} in the view and then scales to the specified zoom level.
// move the view to 42, 100 and zooms to 3x
avenzaViewer.panToPointAndZoom({x:42, y:100}, 3.0, false);
Arguments
Since
9.1
AVENZA.Viewer.search(searchString)
A JavaScript function which passes a web tag string to the search API. The function can be called by an HTML element (e.g. a button or a tag) through an event handler (e.g. onclick).
JavaScript:
    // create a new function which calls the avenzaViewer.search function
    function testSearch(){ avenzaViewer.search("Ontario", false, false); }
 
HTML:
    // attach an event handler (e.g. onclick) to an HTML element (e.g. the  tag below) and call the function created above ("testSearch()") in the event handler.
    
Ontario
 
To clear search results, create a button which can call a search function containing a null search term and setting the arguments to “True” and “True”.
JavaScript:
    function clearSearch(){
        avenzaViewer.search("", true, true);
    };
HTML:
 
Arguments
Since
10.0
Highlights features in the map with web tags that contain the passed search string.
// highlight all parks
function testSearch(){ avenzaViewer.search("Ontario", false, false); }
Arguments
Since
9.1


