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

281
Vistas
How to add a search bar on a map using geo portal extention leaflet

I am trying to update a map that is using leaflet. I want to add a geo search bar. For that I installed this extension

geoportal-extensions-leaflet@2.2.2

Now I tried to run this code in the JS.

    var searchCtrl = L.geoportalControl.SearchEngine({});
    this.map.addControl(searchCtrl);

TypeError: L.geoportalControl is undefined

L is refering to :

    const L = require('leaflet');

So now my question is : Does this error means I should do an other "require" for the leaflet geo-portal extensions ? Or does this means that I have installed the extension wrongly or that I did an other mistake ? Edit : I was misunderstanding how to import the library because I had only tried in online tools like codepen in which imports are different.

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

0

What needs to be done is import both leaflet and geoportal-extensions-leaflet.

After the

npm i geoportal-extensions-leaflet

The source of the extention is present inside

node_modules/geoportal-extensions-leaflet

The library should be imported in the JS using :

const Gp = require('geoportal-extensions-leaflet');

And this code will now works but we should refer to Gp in order to access to the geoportal-extensions-leaflet :

var searchCtrl = Gp.geoportalControl.SearchEngine({});
this.map.addControl(searchCtrl);
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