Learn how to build OpenLayers mapping applications that integrate with ArcGIS location services. Follow step-by-step instructions, copy and paste the code, or just run the solutions.
Display a map
Create and display a map with the basemap layer service.
Change the basemap layer
Switch a basemap layer in a map.
Add a feature layer
Add features from feature layers to a map.
Add a vector tile layer
Add a vector tile layer to a map.
Add an image tile layer
Add an image tile layer to a map.
Display a pop-up
Display feature attributes in a popup.
Query a feature layer (SQL)
Execute a SQL query to access polygon features from a feature layer.
Query a feature layer (spatial)
Execute a spatial query to access polygon features from a feature service.
Style a feature layer
Use data-driven styling to apply symbol colors and styles to feature layers.
Display a custom vector tile style
Add a styled vector basemap layer to a map.
Search for an address
Find an address or place using a search box and the geocoding service.
Find an address near a location with the Geocoding service.
Search for coffee shops, gas stations, restaurants and other nearby places with the Geocoding service.
Find a route and directions
Find a route and directions with the route service.
Find service areas
Calculate the area that can be reached in a given driving time from a location.