当前位置: 首页>>代码示例>>Java>>正文


Java Basemap.createImagery方法代码示例

本文整理汇总了Java中com.esri.arcgisruntime.mapping.Basemap.createImagery方法的典型用法代码示例。如果您正苦于以下问题:Java Basemap.createImagery方法的具体用法?Java Basemap.createImagery怎么用?Java Basemap.createImagery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.esri.arcgisruntime.mapping.Basemap的用法示例。


在下文中一共展示了Basemap.createImagery方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadRaster

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
/**
 * Loads Shasta.tif as a Raster and adds it to a new RasterLayer. The RasterLayer is then added
 * to the map as an operational layer. Map viewpoint is then set based on the Raster's geometry.
 */
private void loadRaster() {
    // create a raster from a local raster file
    Raster raster = new Raster(buildRasterPath());
    // create a raster layer
    final RasterLayer rasterLayer = new RasterLayer(raster);
    // create a Map with imagery basemap
    ArcGISMap map = new ArcGISMap(Basemap.createImagery());
    // add the map to a map view
    mMapView.setMap(map);
    // add the raster as an operational layer
    map.getOperationalLayers().add(rasterLayer);
    // set viewpoint on the raster
    rasterLayer.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {
            mMapView.setViewpointGeometryAsync(rasterLayer.getFullExtent(), 50);
        }
    });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:24,代码来源:MainActivity.java

示例2: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Display Map Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a ArcGISMap with the a Basemap instance with an Imagery base
    // layer
    ArcGISMap map = new ArcGISMap(Basemap.createImagery());

    // set the map to be displayed in this view
    mapView = new MapView();
    mapView.setMap(map);

    // add the map view to stack pane
    stackPane.getChildren().addAll(mapView);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:31,代码来源:DisplayMapSample.java

示例3: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // inflate MapView from layout
    mMapView = (MapView) findViewById(R.id.mapView);

    // create a map with the imagery basemap
    ArcGISMap map = new ArcGISMap(Basemap.createImagery());

    // create an initial viewpoint with a point and scale
    Point point = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
    Viewpoint vp = new Viewpoint(point, 7500);

    // set initial map extent
    map.setInitialViewpoint(vp);

    // set the map to be displayed in the mapview
    mMapView.setMap(map);

    // create a new graphics overlay and add it to the mapview
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    mMapView.getGraphicsOverlays().add(graphicsOverlay);

    //[DocRef: Name=Point graphic with symbol, Category=Fundamentals, Topic=Symbols and Renderers]
    //create a simple marker symbol
    SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, Color.RED, 12); //size 12, style of circle

    //add a new graphic with a new point geometry
    Point graphicPoint = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
    Graphic graphic = new Graphic(graphicPoint, symbol);
    graphicsOverlay.getGraphics().add(graphic);
    //[DocRef: END]

}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:37,代码来源:MainActivity.java

示例4: loadRaster

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
/**
 * Loads ShastaBW.tif as a Raster and adds it to a new RasterLayer. RasterLayer is then added to the map as an
 * operational layer. A List of color values is created (0-149: red) (150-250: yellow). The List is passed to a new
 * ColorMapRenderer, which is then set to the RasterLayer Rendererer. Map viewpoint is then set based on Raster
 * geometry.
 */
private void loadRaster() {
  // create a raster from a local raster file
  Raster raster = new Raster(buildRasterPath());
  // create a raster layer
  final RasterLayer rasterLayer = new RasterLayer(raster);
  // create a Map with imagery basemap
  ArcGISMap map = new ArcGISMap(Basemap.createImagery());
  // add the map to a map view
  mMapView.setMap(map);
  // add the raster as an operational layer
  map.getOperationalLayers().add(rasterLayer);
  // create a color map where values 0-149 are red (Color.RED) and 150-250 are yellow (Color.Yellow)
  List<Integer> colors = new ArrayList<>();
  for (int i = 0; i <= 250; i++) {
    if (i < 150) {
      colors.add(i, Color.RED);
    } else {
      colors.add(i, Color.YELLOW);
    }
  }
  // create a colormap renderer
  ColormapRenderer colormapRenderer = new ColormapRenderer(colors);
  // set the ColormapRenderer on the RasterLayer
  rasterLayer.setRasterRenderer(colormapRenderer);
  // set Viewpoint on the Raster
  rasterLayer.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
      mMapView.setViewpointGeometryAsync(rasterLayer.getFullExtent(), 50);
    }
  });
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:39,代码来源:MainActivity.java

示例5: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Colormap Renderer Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a raster from a local raster file
    Raster raster = new Raster(new File("./samples-data/raster/ShastaBW.tif").getAbsolutePath());

    // create a raster layer
    RasterLayer rasterLayer = new RasterLayer(raster);

    // create a Map with imagery basemap
    ArcGISMap map = new ArcGISMap(Basemap.createImagery());

    // add the map to a map view
    mapView = new MapView();
    mapView.setMap(map);

    // add the raster as an operational layer
    map.getOperationalLayers().add(rasterLayer);

    // create a color map where values 0-150 are red (0xFFFF0000) and 150-250 are yellow (0xFFFFFF00)
    List<Integer> colors = IntStream.range(0, 250)
        .boxed()
        .map(i -> i < 150 ? 0xFFFF0000 : 0xFFFFFF00)
        .collect(Collectors.toList());

    // create a colormap renderer
    ColormapRenderer colormapRenderer = new ColormapRenderer(colors);

    // set the colormap renderer on the raster layer
    rasterLayer.setRasterRenderer(colormapRenderer);

    // set viewpoint on the raster
    rasterLayer.addDoneLoadingListener(() -> {
      if (map.getLoadStatus() == LoadStatus.LOADED) {
        mapView.setViewpointGeometryAsync(rasterLayer.getFullExtent(), 150);
      } else {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Raster Layer Failed to Load!");
        alert.show();
      }
    });

    // add the map view to stack pane
    stackPane.getChildren().addAll(mapView);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:61,代码来源:ColormapRendererSample.java

示例6: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("Raster Layer File");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a raster from a local raster file
    Raster raster = new Raster(new File("./samples-data/raster/Shasta.tif").getAbsolutePath());

    // create a raster layer
    RasterLayer rasterLayer = new RasterLayer(raster);

    // create a Map with imagery basemap
    ArcGISMap map = new ArcGISMap(Basemap.createImagery());

    // add the map to a map view
    mapView = new MapView();
    mapView.setMap(map);

    // add the raster as an operational layer
    map.getOperationalLayers().add(rasterLayer);

    // set viewpoint on the raster
    rasterLayer.addDoneLoadingListener(() -> {
      if (rasterLayer.getLoadStatus() == LoadStatus.LOADED) {
        mapView.setViewpointGeometryAsync(rasterLayer.getFullExtent(), 150);
      } else {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Raster Layer Failed to Load!");
        alert.show();
      }
    });

    // add the map view to stack pane
    stackPane.getChildren().addAll(mapView);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:49,代码来源:RasterLayerFileSample.java

示例7: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // set title, size, and add scene to stage
    stage.setTitle("WMS Layer URL Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a map and add it to the map view
    ArcGISMap map = new ArcGISMap(Basemap.createImagery());
    mapView = new MapView();
    mapView.setMap(map);

    // create a WMS layer
    List<String> wmsLayerNames = Collections.singletonList("0");
    String url = "https://certmapper.cr.usgs.gov/arcgis/services/geology/africa/MapServer/WMSServer?request=GetCapabilities&service=WMS";
    WmsLayer wmsLayer = new WmsLayer(url, wmsLayerNames);
    // load the layer and add it as an operational layer
    wmsLayer.addDoneLoadingListener(() -> {
      if (wmsLayer.getLoadStatus() == LoadStatus.LOADED) {
        map.getOperationalLayers().add(wmsLayer);
        mapView.setViewpoint(new Viewpoint(wmsLayer.getFullExtent()));
      } else {
        Alert alert = new Alert(Alert.AlertType.ERROR, "Failed to load WMS layer");
        alert.show();
      }
    });
    wmsLayer.loadAsync();

    // add the map view to stack pane
    stackPane.getChildren().addAll(mapView);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:44,代码来源:WmsLayerUrlSample.java

示例8: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);
    scene.getStylesheets().add(getClass().getResource("/css/style.css").toExternalForm());

    // set title, size, and add scene to stage
    stage.setTitle("Simple Line Symbol Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create a control panel
    VBox vBoxControl = new VBox(6);
    vBoxControl.setMaxSize(180, 200);
    vBoxControl.getStyleClass().add("panel-region");

    createSymbolFuntionality(vBoxControl);

    final ArcGISMap map = new ArcGISMap(Basemap.createImagery());

    // set initial map view point
    Point point = new Point(-226773, 6550477, SpatialReferences.getWebMercator());
    Viewpoint viewpoint = new Viewpoint(point, 7200); // point, scale
    map.setInitialViewpoint(viewpoint);

    // create a view for this ArcGISMap and set ArcGISMap to it
    mapView = new MapView();
    mapView.setMap(map);

    // creates a line from two points
    PointCollection points = new PointCollection(SpatialReferences.getWebMercator());
    points.add(-226913, 6550477);
    points.add(-226643, 6550477);
    Polyline line = new Polyline(points);

    // creates a solid red (0xFFFF0000) simple line symbol
    lineSymbol = new SimpleLineSymbol(Style.SOLID, 0xFFFF0000, 3);

    // add line with symbol to graphics overlay and add overlay to map view
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    mapView.getGraphicsOverlays().add(graphicsOverlay);
    graphicsOverlay.getGraphics().add(new Graphic(line, lineSymbol));

    // add the map view and control panel to stack pane
    stackPane.getChildren().addAll(mapView, vBoxControl);
    StackPane.setAlignment(vBoxControl, Pos.TOP_LEFT);
    StackPane.setMargin(vBoxControl, new Insets(10, 0, 0, 10));
  } catch (Exception e) {
    // on any error, display the stack trace
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:58,代码来源:SimpleLineSymbolSample.java

示例9: start

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {

  try {
    // create stack pane and application scene
    StackPane stackPane = new StackPane();
    Scene scene = new Scene(stackPane);

    // size the stage, add a title, and set scene to stage
    stage.setTitle("Simple Marker Symbol Sample");
    stage.setWidth(800);
    stage.setHeight(700);
    stage.setScene(scene);
    stage.show();

    // create ArcGISMap with imagery basemap
    final ArcGISMap map = new ArcGISMap(Basemap.createImagery());

    // create spatial reference for WGS 1948
    final SpatialReference webMercator = SpatialReferences.getWebMercator();

    // create a initial viewpoint with a center point and scale
    Point point = new Point(-226773, 6550477, webMercator);
    Viewpoint viewpoint = new Viewpoint(point, 7500);

    // set initial view point to the ArcGISMap
    map.setInitialViewpoint(viewpoint);

    // create a view and set ArcGISMap to it
    mapView = new MapView();
    mapView.setMap(map);

    // create new graphics overlay and add it to the mapview
    GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
    mapView.getGraphicsOverlays().add(graphicsOverlay);

    // create a red (0xFFFF0000) simple marker symbol
    SimpleMarkerSymbol symbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF0000, 12);

    // create a new graphic with a our point and symbol
    Graphic graphic = new Graphic(point, symbol);
    graphicsOverlay.getGraphics().add(graphic);

    // add the map view and control box to stack pane
    stackPane.getChildren().add(mapView);
  } catch (Exception e) {
    // on any error, display the stack trace.
    e.printStackTrace();
  }
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-java,代码行数:51,代码来源:SimpleMarkerSymbolSample.java

示例10: onCreate

import com.esri.arcgisruntime.mapping.Basemap; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  // set flag for showing total population or population density
  showTotalPopulation = true;

  // inflate population type toggle button
  final Button togglePopButton = findViewById(R.id.toggle_button);

  // get us census data as a service feature table
  ServiceFeatureTable statesServiceFeatureTable = new ServiceFeatureTable(
      getResources().getString(R.string.us_census_feature_service));

  // add the service feature table to a feature layer
  final FeatureLayer statesFeatureLayer = new FeatureLayer(statesServiceFeatureTable);
  // set the feature layer to render dynamically to allow extrusion
  statesFeatureLayer.setRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);

  // create a scene and add it to the scene view
  ArcGISScene scene = new ArcGISScene(Basemap.createImagery());
  SceneView sceneView = findViewById(R.id.sceneView);
  sceneView.setScene(scene);

  // add the feature layer to the scene
  scene.getOperationalLayers().add(statesFeatureLayer);

  // define line and fill symbols for a simple renderer
  SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, Color.BLACK, 1.0f);
  SimpleFillSymbol fillSymbol = new SimpleFillSymbol(SimpleFillSymbol.Style.SOLID, Color.BLUE, lineSymbol);
  final SimpleRenderer renderer = new SimpleRenderer(fillSymbol);
  // set renderer extrusion mode to base height, which includes base height of each vertex in calculating z values
  renderer.getSceneProperties().setExtrusionMode(Renderer.SceneProperties.ExtrusionMode.BASE_HEIGHT);
  // set the simple renderer to the feature layer
  statesFeatureLayer.setRenderer(renderer);

  // define a look at point for the camera at geographical center of the continental US
  Point lookAtPoint = new Point(-10974490, 4814376, 0, SpatialReferences.getWebMercator());
  // add a camera and set it to orbit the look at point
  Camera camera = new Camera(lookAtPoint, 20000000, 0, 55, 0);
  OrbitLocationCameraController orbitCamera = new OrbitLocationCameraController(lookAtPoint, 20000000);
  sceneView.setCameraController(orbitCamera);
  sceneView.setViewpointCamera(camera);

  // set button listener
  togglePopButton.setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View v) {
      // set extrusion properties to either show total population or population density based on flag
      if (showTotalPopulation) {
        // divide total population by 10 to make data legible
        renderer.getSceneProperties().setExtrusionExpression("[POP2007] / 10");
        // change text of button to total pop
        togglePopButton.setText(R.string.total_pop);
        showTotalPopulation = false;
      } else {
        // multiple population density by 5000 to make data legible
        renderer.getSceneProperties().setExtrusionExpression("[POP07_SQMI] * 5000");
        // change text of button to pop density
        togglePopButton.setText(R.string.density_pop);
        showTotalPopulation = true;
      }
    }
  });
  // click to set initial state
  togglePopButton.performClick();
}
 
开发者ID:Esri,项目名称:arcgis-runtime-samples-android,代码行数:68,代码来源:MainActivity.java


注:本文中的com.esri.arcgisruntime.mapping.Basemap.createImagery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。