Sign up for an ArcGIS account to start building applications with OpenLayers:
Create an account to access, manage, and monitor the use of location services.
ArcGIS Location Platform
- For individual developers.
- Build public applications that don't require users to sign in with an ArcGIS account.
- Billing: Use free tiers and pay-as-you-go to use location services and host your data.
- Learn more about the product and billing at ArcGIS Location Platform.
ArcGIS Online
- For developers in an organization.
- Build private applications for your organization that requires users to sign in with an ArcGIS account.
- Build public applications that don't require users to sign in.
- Build low-code/no-code applications with app builders.
- Billing: Pay for credits yearly to use location services and host your data.
- Learn more about the product and billing at ArcGIS Online.
Browse the topics to learn what you can build with OpenLayers.
Maps
Display 2D maps with the basemap styles service.
Data services
Access and display hosted feature layers, vector tiles, and map tiles from data services.
Geocoding
Find addresses and get suggestions with the geocoding service.
Routing
Find routes and directions and perform analyses with the routing service.
Places
Search for places near a location with the places service.
Data enrichment
Get local facts and demographic data with the GeoEnrichment service.
Spatial analysis
Perform feature analysis with the spatial analysis services.
Create developer credentials so you can get an access token.
API key credentials
- Build public applications that don't require users to sign in with an ArcGIS account.
- Access tokens are long-lived.
- Service usage billed to the developer.
- Learn more in API key authentication.
OAuth 2.0 credentials (for user authentication)
- Build private applications for your organization that requires users to sign in with an ArcGIS account.
- Access tokens are short-lived.
- Service usage is billed to the organization of the user signed into the application.
- Learn more in User authentication.
Build your first mapping application with the basemap styles service using OpenLayers.
<script>
const map = new ol.Map({ target: "map" });
map.setView(
new ol.View({
center: ol.proj.fromLonLat([-25, 25]), // Starting location [longitude, latitude]
zoom: 2
})
);
const accessToken = "YOUR_ACCESS_TOKEN";
const basemapId = "arcgis/outdoor";
const basemapURL = `https://basemapstyles-api.arcgis.com/arcgis/rest/services/styles/v2/styles/${basemapId}?token=${accessToken}`;
olms.apply(map, basemapURL).then(() => {
// Add Esri attribution
// Learn more in https://esriurl.com/attribution
const source = map.getLayers().item(0).getSource();
source.setAttributions("Powered by <a href='https://www.esri.com/en-us/home' target='_blank'>Esri</a> | ")
});
</script>