nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 697 forks source link

SymbolLayer iconImage accept base64? #1324

Open trevor-trou opened 6 years ago

trevor-trou commented 6 years ago

I have a base64-representation of a png. I'd like to be able to use the base64 as my imageIcon in a SymbolLayer, but I'm unsure if this is a supported feature or not.

In the example, you specify the iconImage as follows:

import exampleIcon from '../assets/example.png';

const styles = MapboxGL.StyleSheet.create({
  icon: {
    iconImage: exampleIcon,
    iconAllowOverlap: true,
    iconSize: 0.5,
  },
});

...

<MapboxGL.SymbolLayer
              id="symbolLocationSymbols"
              minZoomLevel={1}
              style={styles.icon}
            />

Instead of importing the .png and using that as the iconImage in the stylesheet, is it possible to use a base64 string instead? Something like:

const styles = MapboxGL.StyleSheet.create({
  icon: {
    iconImage: {"imageData": "iVBORw0KGgoA ... FTkSuQmCC", // base64 string
"contentType": "image/png",},
    iconAllowOverlap: true,
    iconSize: 0.5,
  },
});
trevor-trou commented 6 years ago

any word on this one?

felixchan commented 5 years ago

Bump.

I'd like to know if base64 as icon is possible as well.

wywzixin commented 5 years ago

I'd like to know if base64 as icon is possible as well.

wywzixin commented 5 years ago

Have you solved it?

any word on this one?

Excuse me,Have you solved it?

wywzixin commented 5 years ago

Bump.

I'd like to know if base64 as icon is possible as well.

Excuse me,Have you solved it?

trevor-trou commented 5 years ago

@gisert Since I didn’t get any response from the dev team, I ended up forking the project and implementing my own solution. I had to implement custom code in both the Android and iOS projects, but it was fairly painless.

wywzixin commented 5 years ago

@gisert Since I didn’t get any response from the dev team, I ended up forking the project and implementing my own solution. I had to implement custom code in both the Android and iOS projects, but it was fairly painless.

Try to contact the dev team again,I also try, Come on, we can definitely make it

kristfal commented 5 years ago

@trevor-trou I’m sure we can get this functionality into the repo, but I think it is wise to wait til 7.0.0 is released.

Mapbox expect it to hit mid/late January. 7.0.0 introduces a lot of large changes, so it’s better to wait for it to hit master.

dm1014 commented 5 years ago

bump