Reputation: 83
Hello community I'm starting with Gmap Primefaces component, and want to know how to change the icons. I have relied on the showcase of Primefaces:
this.advancedModel.addOverlay(new Marker(coord1, "Konyaalti", "konyaalti.png", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png"));
this.advancedModel.addOverlay(new Marker(coord2, "Ataturk Parki", "ataturkparki.png"));
this.advancedModel.addOverlay(new Marker(coord4, "Kaleici", "kaleici.png", "http://maps.google.com/mapfiles/ms/micons/pink-dot.png"));
this.advancedModel.addOverlay(new Marker(coord3, "Karaalioglu Parki", "karaalioglu.png", "http://maps.google.com/mapfiles/ms/micons/yellow-dot.png"));
I've downloaded the icons to my project, and I've routed, but just does not work and marker icons are samples.
StringBuilder ruta = new StringBuilder();
ruta.append(getContext().getRealPath(Constantes.DIVISOR));
ruta.append("resources/maps/images/");
StringBuilder bluedot = new StringBuilder();
bluedot.append(ruta);
bluedot.append("blue-dot");
bluedot.append(Constantes.EXTENSION_FORMATO_PNG);
StringBuilder pinkdot = new StringBuilder();
pinkdot.append(ruta);
pinkdot.append("pink-dot");
pinkdot.append(Constantes.EXTENSION_FORMATO_PNG);
StringBuilder yellowdot = new StringBuilder();
yellowdot.append(ruta);
yellowdot.append("yellow-dot");
yellowdot.append(Constantes.EXTENSION_FORMATO_PNG);
System.out.println("---> "+bluedot.toString());
//Icons and Data
this.advancedModel.addOverlay(new Marker(coord1, "Konyaalti", "konyaalti.png", bluedot.toString()));
this.advancedModel.addOverlay(new Marker(coord2, "Ataturk Parki", "ataturkparki.png"));
this.advancedModel.addOverlay(new Marker(coord4, "Kaleici", "kaleici.png", pinkdot.toString()));
this.advancedModel.addOverlay(new Marker(coord3, "Karaalioglu Parki", "karaalioglu.png", yellowdot.toString()));
Being well the image file path, but still does not consider the Marker PrimeFaces, to which it should be ???
Console:
D:\springsource\apache tomcat 7.0.53\webapps\geotermica\resources\maps\images\blue-dot.png
Upvotes: 1
Views: 3355
Reputation: 20253
If you want to point to a file on your file system you should use the file://
scheme. See: How to specify a local file within html using the file: scheme?
If you want to create a relative URL to fetch the image from your webserver you should use the context path instead of the real path:
StringBuilder ruta = new StringBuilder();
ruta.append(FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath());
ruta.append("/resources/maps/images/");
Upvotes: 3