2016-07-20 13 views
0

Javscript 4.0 API 용 ArcGIS API를 처음 사용했습니다. API 웹 사이트에서 방해석 샘플 사용. 기능 레이어에서지도보기 및 장면보기에 어디에서 추가 할 수 있습니까? 여기 방해석 맵 샘플 https://developers.arcgis.com/javascript/latest/sample-code/layers-featurelayer/index.htmlArcgis API for Javascript 4 방해석지도 추가 기능 레이어

/******************** 
    * Add feature layer 
    ********************/ 

    // Carbon storage of trees in Warren Wilson College. 
    var featureLayer = new FeatureLayer({ 
     url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0" 
    }); 

    map.add(featureLayer); 

: https://developers.arcgis.com/javascript/latest/sample-code/frameworks-bootstrap/index.html

을 이에 레이어를 추가 할 어떤 부분이 확실하지 않다 기본적으로 나는 여기에 기능 층 샘플 을 병합하기 위해 노력하고있어. 나는 몇 번이나 시도했다. 아래를 참조하십시오. 감사합니다

 /****************************************************************** 
    * 
    * Create the map and scene view and ui components 
    * 
    ******************************************************************/ 

    // Map 
    var map = new Map({ 
    basemap: app.basemap 
    }); 
    app.mapView = new MapView({ 
    container: "mapViewDiv", 
    map: map, 
    center: app.center, 
    scale: app.scale, 
    padding: app.viewPadding, 
    popup: new Popup({ 
     dockOptions: app.dockOptions 
    }), 
    ui: { 
     components: app.uiComponents 
    } 
    }); 

    // Scene 
    var mapScene = new Map({ 
    basemap: app.basemap, 
    ground: "world-elevation" 
    }); 
    app.sceneView = new SceneView({ 
    container: "sceneViewDiv", 
    map: mapScene, 
    center: app.center, 
    scale: app.scale, 
    padding: app.viewPadding, 
    popup: new Popup({ 
     dockOptions: app.dockOptions 
    }), 
    ui: { 
     components: app.uiComponents 
    } 
    }); 

    // Set the active view to scene 
    app.activeView = app.mapView; 

    // Create the search widget and add it to the navbar instead of view 
    app.searchWidget = new Search({ 
    view: app.activeView 
    }, "searchWidgetDiv"); 
    app.searchWidget.startup(); 

    // IS THIS WHERE I CAN ADD LAYERS?????????????????? 
    var featureLayer = new FeatureLayer({ 
     url: "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0" 
    }); 

    app.mapView.map.add(featureLayer); 
    app.sceneView.map.add(featureLayer); 

답변

-1

지도 객체에 4.0을 직접 추가 할 수 있습니다. 작은 예제는 여기 API 문서를보십시오 : https://developers.arcgis.com/javascript/latest/api-reference/esri-Map.html#layers. 당신은 당신이 당신이 그 (것)들을 렌더링 할지도 중 적용되었는지 확인해야합니다

var featureLayer = new FeatureLayer(url); 
var map = new Map({ 
    basemap: app.basemap, 
    layers: [featureLayer] 
}); 

:

기본적으로는 다음과 같이 보일 것입니다.

+0

이 게시물에 잘못된 것이 있으면 해당 정보를 제공하거나 정답을 제공하여 커뮤니티를 위해 업데이트 할 수 있도록하십시오. –