ArcGIS API for javascript3.x learning Note [4] loading Basemaps (iii) "Open Street map opening street maps"

Source: Internet
Author: User
Tags naming convention

Open Street Map

OpenStreetMap (OSM, Chinese is an open street map) is an online map collaboration program that aims to create a world map of content that is free and editable for all.

OSM is a free, open-source, editable map service created by the Internet community. OpenStreetMap It is the use of public collective power and unpaid contributions to improve map-related geographic data. OSM is not-for-profit, and it returns the data back to the community for other products and services. Other maps sell most of the map data to third parties.

The OSM map is drawn by users based on portable GPS devices, aerial photographs, other free content, and even local wisdom alone. The map images and vector data on the site are shared with creative names-sharing 2.0 licenses in the same way.with the Esri/layers/openstreetmaplayer class, open street charts can be used as base basemaps.
<!DOCTYPE HTML><HTML><Head>    <MetaCharSet= "Utf-8">    <title>Access to open Street map</title>    <Linkrel= "stylesheet"href= "Http://js.arcgis.com/3.9/js/esri/css/esri.css">    <style>html, body, #mapDiv{padding:0;margin:0;Height:100%;        }        /*set Graph to grayscale*/#mapDiv_osmLayer img{Filter:URL (filters.svg#grayscale)!important; /*Firefox 3.5+*/Filter:Gray!important; /*ie5+*/-webkit-filter:Grayscale (1)!important; /*Webkit nightlies &amp; Chrome Canary*/        }    </style>    <Scriptsrc= "http://js.arcgis.com/3.9/"></Script>    <Script>require (["Esri/map", "Esri/layers/openstreetmaplayer", "dojo/domready!"], function(Map, openstreetmaplayer) {//Here's the code for creating maps and adding Basemaps            varMap= NewMap ("Mapdiv"); varOSM= NewOpenstreetmaplayer ({ID:'Osmlayer'            });        Map.addlayer (OSM);    }); </Script></Head><Bodyclass= "Tundra">    <DivID= "Mapdiv"></Div></Body></HTML>

The naming convention for the ArcGIS API for JavaScript to create HTML elements for each layer is "map div id" + "Layer ID", so as we instantiate the Openstreetmaplayer class, we specify the layer's id "Osmlayer" , and the element ID for the map is "Mapdiv", then the element ID for the layer is "Mapdiv_osmlayer".

Implementation results:

ArcGIS API for javascript3.x learning Note [4] loading Basemaps (iii) "Open Street map opening street maps"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.