P Narasimha

P Narasimha

  • 701
  • 1.2k
  • 244.1k

Change Text of Individual labels on map ( OpenLayers )

Aug 28 2020 8:01 AM
I want to change the text of a place on OpenLayers map, it needs to be changed from Persian Gulf to Arabian Gulf
 
I tried to see if there is any way I can make this change using the OpenLayers API documentation and found no luck.
 
https://openlayers.org/en/latest/apidoc/
 
Following is code :
  1. import TileLayer from 'ol/layer/Tile';  
  2. import VectorLayer from 'ol/layer/Vector';  
  3. vectorSource = new VectorSource({  
  4. // url: '/assets/data/countries.geojson',  
  5. url: '/assets/data/countries.json',  
  6. format: new GeoJSON()  
  7. });  
  8. mapLayer = new VectorLayer({  
  9. source: this.vectorSource,  
  10. declutter: true  
  11. });  
  12. markerLayer = new VectorLayer({  
  13. source: new VectorSource({}),  
  14. style: this.mapStyle  
  15. });  
  16. linesLayer = new VectorLayer({  
  17. source: new VectorSource({}),  
  18. style: this.lineStyle  
  19. });  
Is there any way to change this? I am still going through the OpenLayers API to find if there is anyway.
 
Following is the map location

Answers (1)