Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

109
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!