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

291
Vistas
OpenLayers source.getExtent() / view.fit() does not show entire feature

Using OL 6.5.0, the following snippet produces a map where the feature goes outside of the bounds of the map, rather than being completely contained (with a 20px margin) within the bounds of the map.

const extent = layer.getSource().getExtent();

view.fit(extent, {
  size: map.getSize(),
  padding: [20, 20, 20, 20],
});

I tried setting nearest to true / false but the result is the same.

Result (ignore the fuzz):

out of bounds

I expect the entire feature to be within the border of the map, but it is not. Am I missing something?

Expected (or close to it -- again, ignore the fuzz):

in bounds

Here's how I'm instantiating the map:

const map = this.map = maps[mapTargetId] = new ol.Map({
  target: mapTargetId,
  overlays: [overlay],
  layers: await this.getBaseLayers(),
  view: new ol.View({
    projection,
    center: [0, 0],
    zoomFactor: 2,
    zoom: defaultZoom,
    minZoom: 1,
    maxZoom: 12,
  })
});
about 4 years ago · Juan Pablo Isaza
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