gis 지도 레이어 (프론트 데스크톱)

6622 단어
1. Dojo 프레임워크;
2. 가방의 인용;
3. 도면층 추가;

</span><span style="color:#e8bf6a;">
</span><span style="color:#e8bf6a;">    </span><span style="color:#808080;">// 
</span><span style="color:#808080;">    </span><span style="color:#cc7832;"><strong>var </strong></span>myMap<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span><span style="color:#cc7832;"><strong>var </strong></span>mapLayer<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span><span style="color:#cc7832;"><strong>var </strong></span>mapUrl<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span>dojo.require(<span style="color:#6a8759;">"esri.config"</span>)<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span>dojo.require(<span style="color:#6a8759;">"dojo/domReady!"</span>)<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span>dojo.require(<span style="color:#6a8759;">"esri.layers.graphics"</span>)<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span>dojo.require(<span style="color:#6a8759;">"esri.layers.GraphicsLayer"</span>)<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span>dojo.require(<span style="color:#6a8759;">"esri.geometry.jsonUtils"</span>)<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span>dojo.require(<span style="color:#6a8759;">"esri.map"</span>)<span style="color:#cc7832;">;</span><span style="color:#808080;">// 
</span><span style="color:#808080;">
</span><span style="color:#808080;">    </span>dojo.addOnLoad(<span style="color:#ffc66d;">init</span>)<span style="color:#cc7832;">;</span><span style="color:#808080;">// 
</span><span style="color:#808080;">
</span><span style="color:#808080;">    // 
</span><span style="color:#808080;">    </span><span style="color:#cc7832;"><strong>function </strong></span><span style="color:#ffc66d;">init</span>() {
        <span style="color:#808080;">// 
</span><span style="color:#808080;">        </span><span style="color:#cc7832;"><strong>var </strong></span>initExtent = <span style="color:#cc7832;"><strong>new </strong></span>esri.<span style="color:#9876aa;">geometry</span>.Extent({
            <span style="color:#9876aa;">"xmin"</span>: <span style="color:#6897bb;">12676062</span><span style="color:#cc7832;">,
</span><span style="color:#cc7832;">            </span><span style="color:#9876aa;">"ymin"</span>: <span style="color:#6897bb;">2566164</span><span style="color:#cc7832;">,
</span><span style="color:#cc7832;">            </span><span style="color:#9876aa;">"xmax"</span>: <span style="color:#6897bb;">12710191</span><span style="color:#cc7832;">,
</span><span style="color:#cc7832;">            </span><span style="color:#9876aa;">"ymax"</span>: <span style="color:#6897bb;">2588674</span><span style="color:#cc7832;">,
</span><span style="color:#cc7832;">            </span><span style="color:#9876aa;">"spatialReference"</span>: {<span style="color:#9876aa;">"wkid"</span>: <span style="color:#6897bb;">102100</span>}
        })<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">        </span><span style="color:#808080;">// map 
</span><span style="color:#808080;">        </span>myMap = <span style="color:#cc7832;"><strong>new </strong></span>esri.Map(<span style="color:#6a8759;">"mapDiv"</span><span style="color:#cc7832;">, </span>{<span style="color:#9876aa;">extent</span>: initExtent})<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">
</span><span style="color:#cc7832;">        </span>mapUrl = <span style="color:#6a8759;">"http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"</span><span style="color:#cc7832;">;
</span><span style="color:#cc7832;">        </span><span style="color:#808080;">// Layer 
</span><span style="color:#808080;">        </span>mapLayer = <span style="color:#cc7832;"><strong>new </strong></span>esri.<span style="color:#9876aa;">layers</span>.ArcGISTiledMapServiceLayer(mapUrl)<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">        </span><span style="color:#808080;">// 
</span><span style="color:#808080;">        </span>myMap.addLayer(mapLayer)<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">
</span><span style="color:#cc7832;">        </span><span style="color:#808080;">// resize 
</span><span style="color:#808080;">        </span>dojo.connect(myMap<span style="color:#cc7832;">, </span><span style="color:#6a8759;">'onLoad'</span><span style="color:#cc7832;">, </span><span style="color:#cc7832;"><strong>function </strong></span>(theMap) {
            dojo.connect(dijit.byId(<span style="color:#6a8759;">'mapDiv'</span>)<span style="color:#cc7832;">, </span><span style="color:#6a8759;">'resize'</span><span style="color:#cc7832;">, </span>myMap<span style="color:#cc7832;">, </span>myMap.<span style="color:#ffc66d;">resize</span>)<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">        </span>})<span style="color:#cc7832;">;
</span><span style="color:#cc7832;">    </span>}

<span style="color:#e8bf6a;">

좋은 웹페이지 즐겨찾기