0
map.loadImage('works/static/src/img/icon2.png', function(error, image) {
     if (error)
     {
        console.log(error)
     }
     map.addImage('icon2', image);

Hello everyone.I am woking on the a web map project by using maplibre-gl-js.I can add an icon to my map by using above the code but I want to get to image from my database and the image is stored as binary format.How can to convert to this binary data to adding my map ?

Anil_Can
  • 3
  • 2
  • Write a backend that serves your image from the database on the url *works/dynamic/img/icon2.png*. There's nothing the frontend should need to do differently. The current question is not answerable, if you need help with the backend then you'll need to provide more details. – Bergi Feb 09 '22 at 12:48
  • Thanks for your reply.I can upload the images which are uploaded by the users into the server, I guess there is no other solution. – Anil_Can Feb 10 '22 at 06:58
  • What do you mean by "*upload the images into the server*"? No, you can store the images in a database just fine. There are lots of solutions how to do this, but your question doesn't contain any details of what your server is doing. – Bergi Feb 10 '22 at 10:42
  • Sorry for the less information.I am working on the employee openerm project.It is a project that stores the spatial data, name etc. of the unit that the working people are associated. [Interface](https://imgur.com/a/j0G9EnY). I can get to the image data as binary from the database but I cannot use this data directly.Reason [loadImage](https://maplibre.org/maplibre-gl-js-docs/api/map/#map#loadimage) – Anil_Can Feb 10 '22 at 11:39

0 Answers0