Reputation: 13
I use gmap in my web project. I have code snippet code:
<p:gmap id="harita" center="#{KoordinatEdit.istasyon.lat},#{KoordinatEdit.istasyon.lng}" zoom="15" type="HYBRID" model="#{KoordinatEdit.simpleModel}" style="width:600px;height:400px">
<p:ajax event="markerDrag" listener="#{KoordinatEdit.onMarkerDrag}" update="messages,harita" />
</p:gmap>
Marker marker=event.getMarker();
istasyon.setLat(String.format("%.10g%n",marker.getLatlng().getLat()));
istasyon.setLng(String.format("%.10g%n",marker.getLatlng().getLng()));
FacesUtil.addMessage("Lat:" + latlng.getLat() + ", Lng:" + latlng.getLng(), FacesMessage.SEVERITY_INFO);
On my local server it works, String.format returns coordinate like '37.8709573', but upload to web server String.format changes coordinate like 37,8709573 with comma. For this reason gmap center has errors.
How can I solve this problem? Any idea is greatly appreciated.
Upvotes: 1
Views: 195
Reputation: 2723
If you can't figure out the issue with the reformat you could always just replace the comma with a period?
str = str.replaceAll(",",".");
Upvotes: 1