Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

282
Vistas
How to display full extent of a webmap using ArcGIS Javascript API?

I'm using ArcGIS Javascript API 4.20 to retrieve a webmap from ArcGIS online, and I'm able to load and display it by providing its ID, using the following simple script:

import MapView from "https://js.arcgis.com/4.20/@arcgis/core/views/MapView.js";
import WebMap from "https://js.arcgis.com/4.20/@arcgis/core/WebMap.js";
import esriId from "https://js.arcgis.com/4.20/@arcgis/core/identity/IdentityManager.js";

var webmap = new WebMap({
    portalItem: {
    id: "1234567890qwertyuiop"
    }
});

var view = new MapView({
    map: webmap,
    container: "mapFrame", //ID of the HTML element where the map will be displayed
});

I need to find a way to programmatically adjust the map's zoom when it gets loaded, so that every layer/feature contained in it is visible in the area displayed in the map.

I've found examples and references using a "fullExtent" function, but as far as I understand this is designed to work with a layer. I've not been able to figure out how to apply the same idea to the full webmap instead and make it work: https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#fullExtent

webmap.when(function(){
    view.extent = webmap.fullExtent;
});

//I've tried using this. It doesn't raise any errors, but does nothing.

Could you please let me know what am I doing wrong? Or share any ideas to achieve what I need programmatically using a different approach?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

WebMap does not have a fullExtent property, so that is not going to work.

I guess you are trying to have a way to dynamically set the initial extent related to some layers features. If that is the case you should calculate it using the fullExtent property of the layers involved. That should not be too hard to pull it, you can do it manually iterating on all the full extents of the layers and getting the minimal and maximal x and y, or use union method of Extent (1).

Another way to think the problem, is to use a fixed area of interest, calculate manually the extent and set it to the view. Or choose a center and play with the zoom levels.

1 - ArcGIS API - Extent union

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda