1

I'm using the DragAndDrop interaction in OpenLayers. I'm trying to drop an image that contains a geospatial location in its metadata to create a feature out of it.

I created a Format to read the file using the Exif-JS library. By default, Format objects in OpenLayers read the content of files as text.

How can I take the returned text and convert it back to a blob or an ArrayBuffer ? Exif-JS won't recognize a string.

I am not allowed to edit the library, but while testing, I confirmed that returning reader.readAsArrayBuffer(file);was working fine to recreate a blob and send it to the exif-js library.

Is there a way to make it work with OpenLayers converting the file as text first?

Community
  • 1
  • 1
kbonnelly
  • 189
  • 1
  • 1
  • 11
  • Check this post [Converting between strings and ArrayBuffers](https://stackoverflow.com/questions/6965107/converting-between-strings-and-arraybuffers) – cabesuon Feb 05 '20 at 15:56
  • `ol/format/MVT` reads features from an ArrayBuffer, see the source code https://github.com/openlayers/openlayers/blob/master/src/ol/format/MVT.js – Mike Feb 05 '20 at 17:27

0 Answers0