How will I plot a marker on Google Map with my geometry points? Here is the sample geometry points POINT Z (642823.3317 937067.5592999998 0)
.
I added a JTS dependencies which is org.locationtech.jts
. Here is my code:
// get the POINT Z (642823.3317 937067.5592999998 0) String geometryPoints = record.getGeometry(); // parse the points using JTS WKTReader reader = new WKTReader(); Geometry geometry = reader.read(geometryPoints); if (geometry instanceof Point) { double lat = geometry.getCoordinate().y; double lng = geometry.getCoordinate().x; LatLng position = new LatLng(lat, lng); mMap.addMarker(new MarkerOptions() .position(position) .title(record.getKilometerPostId()) .snippet(record.getXsp()) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE))); }
I also logged the geometry.getCoordinate().x
and it print on my Logcat. However, it does not show on my Google Map. What maybe the problem?
Thank you for the help!