Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icon not showing in GMapsFX 2.10.0 #173

Open
FedericoFerrero opened this issue Nov 13, 2018 · 3 comments
Open

Icon not showing in GMapsFX 2.10.0 #173

FedericoFerrero opened this issue Nov 13, 2018 · 3 comments

Comments

@FedericoFerrero
Copy link

Hi everyone, I have to show a custom marker and I wrote this code:

String imgPath = MarkerImageFactory.createMarkerImage("/Images/sun.png", "png");
markerOptions.position( new LatLong(Double.parseDouble(lat), Double.parseDouble(lon)))
.visible(Boolean.TRUE)
.label(result)
.icon(imgPath);

where Images is a folder in the project that contains the sun.png image, but it does not work. Do you have any issue?

@GeoffCapper
Copy link
Collaborator

@FedericoFerrero Is the image bundled in the jar when you build, or does it sit in a folder outside? If it's outside you need to use the file: scheme.

@FedericoFerrero
Copy link
Author

markerOptions.position( new LatLong(Double.parseDouble(lat), Double.parseDouble(lon)) )
.visible(Boolean.TRUE)
.label(result)
.icon(MarkerImageFactory.createMarkerImage("/resources/sun.png", "png"));

This is my code now and this is my project folder asset:

cattura

I really can't get what I'm doing wrong.

@RobtechsCR
Copy link

This worked for me.

String path=MarkerImageFactory.createMarkerImage("/imagenes/busicon.png", "png");
path = path.replace("(", "");
path = path.replace(")", "");

markerOptions.position( new LatLong(lat, lon) )
.visible(Boolean.TRUE)
.title("My Marker").label("200").icon(path);

Check replace lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants