I take columns from result set and retrieve geolocation as PGObject. In the next step I want to convert it to org.postgis.Point but I get the following exception.
Do you know how can get latitude and longitude from PGObject? Actually I want to convert PGObject type to org.postgis.Point.
I tried this, but does not work. In the result set:
(PGobject) rs.getObject("geolocation"),
In the constructor of object.
this.geolocation = (Point) geolocation;
Exception:
java.lang.ClassCastException: org.postgresql.util.PGobject cannot be cast to org.postgis.Point
at com.kaloudia.api.domain.custom.CompanyResultView.<init>(CompanyResultView.java:87) ~[classes/:na]
at com.kaloudia.api.manager.SearchManager.lambda$searchCompanies$0(SearchManager.java:166) ~[classes/:na]
at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:93) ~[spring-jdbc-4.2.5.RELEASE.jar:4.2.5.RELEASE]