Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

104
Visualizações
Is there any way to access the locations for a vector layer in OpenLayers?

I created a vector layer called "locationGeoJSON" in OpenLayers using a GeoJSON file and I'm trying to use the .getSource() method to access the location data for the layer. I'm currently using a workaround where I access the location data with locationGeoJSON.getSource().Uu. But I feel like there's some get method that can be used to retrieve the data in a more appropriate manner. I've tried using locationGeoJSON.getSource().getFeatures(), but I just get an empty array in return. Can anyone give some insight into this issue? Here is the console output after I use .getSource() on my vector layer. How do I access the "Uu" property?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

locationGeoJSON.getSource().getFeatures() is correct, but you may have to wait for the geojson file to load before calling it.

locationGeoJSON.getSource().on('featuresloadend', function (evt) {
    console.log(evt.target.getFeatures());
});

The object in the console output already has the features because it is linked to the original object and refreshes whenever its state changes.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda