Maps in JavaScript

js.arcgis.com

esri/Map Class

contains properties and methods for storing, managing, and overlaying layers common to both 2D and 3D viewing.

 

A single map may be referenced by multiple views

Views

A MapView displays a 2D view of a Map instance. An instance of MapView must be created to render a Map in 2D.

 

A SceneView displays a 3D view of a Map instance.

Layers

  • the most fundamental component of a Map
  • a collection of spatial data in the form of vector graphics or raster images that represent real-world phenomena.
  • may contain discrete features that store vector data or continuous cells/pixels that store raster data.
  • Multiple layers may be added to the same map and overlaid on top of one another for visualization and analytical purposes

Which to Use?

  • GraphicsLayer (client-side layer)
    • Dynamic data from other part (JS or back-end) of application.
    • Examples:
      • Place a point on the map where the user's registered location is
      • Allow the user to click on the map and you want to place a pin at that location
    • Demo (associated guide)

Which to Use?

  • FeatureLayer
    • Similar in representation to the GraphicsLayer, but data displayed comes from an ArcGIS REST API (FeatureService URL)
    • Examples:
      • Show building footprints (polygons) of a campus
      • Show voting districts and allow visitor to highlight which districts voted in a specific way
      • You have a dataset you want to host in ArcGIS Online and then display it (Guide)
    • Demo
    • Query Demo
    • Create a Hosted FeatureService from scratch demo

Which to Use?

  • MapImageLayer
    • allows you to display and analyze data from sublayers defined in a map service, exporting images instead of features
    • MapImageLayer processing is handled by the server, not the client.
    • Examples:
      • Displaying reference layers on your map, like crime data from ArcGIS Living Atlas.
        • If you find any ArcGIS REST Endpoint online that ends with "/mapserver/" in general you can add that to your map using this layer type.
    • Demo - Modify rendering of MapImageLayer on the Fly
    •  

Can't Choose?

  • Build your map in ArcGIS Online, then create that map by ID.
  • Demo

Slack: #esri

Bonus: Geolocation

Made with Slides.com