iag-geo / bootleaf

An open-source version of IAG's Bootleaf fork
https://demo.bootleaf.xyz
MIT License
89 stars 65 forks source link

View image on pupup from geoJSON #34

Open andres-ss25 opened 3 years ago

andres-ss25 commented 3 years ago

Hello I have a Geo JSON that contains the path in the project of some images. How do I make the image appear in the brand's popup. mapa

slead commented 3 years ago

Hola Andres,

There is nothing in the app to support this yet, but it's a good idea.

Within app.js there is a function configurePopup which creates the table containing the key:value pairs. The function formatPopup then calls formatValue to format the value for decimal places, dates, text prefix, etc:

function formatValue(value, field){
  // (summarised code)
  // Given a value and a field definition, apply the appropriate formatting
  // Used in the Query Widget and Identify functions

    if (field.decimals !== undefined) {
      value = round(value, field.decimals);
    }
    if (field.date !== undefined && value !== null){
      ...
        var theDate = moment(new Date(value));
    }
    if (field.thousands !== undefined) {
      value = addThousandsSeparator(value);
    }
    if (field.prefix !== undefined){
      value = field.prefix + value;
    }

  return (value);
}

You could add a check here for image and if so add the image source. (A hyperlink would also be useful here).

Unfortunately I won't have time to do this in the near future, but please feel free to submit a pull-request if you have the time to do this.

Cheers, Steve