Is it possible to use wktToGeometry inversely?

by Carlos FTG   Last Updated June 12, 2019 07:22 AM - source

I am using wktToGeometry in order to transform the given coordinates in String format to Geometry and be saved in a DB.

Now I would like to do the inverse process, retrieve the coordinates from the DB in Geometry format and convert them to String, to be setted into a bean.

This is the code which converts String to Geometry:

public static GeometryEntity convertToGeometryEntity(NonGeometryEntity nonGeometry) throws ParseException {



    GeometryEntity geometryEntity = new GeometryEntity();

            UserEntity userEntity;

            geometryEntity.setUserId(Long.parseLong(nonGeometry.getUserId()));

            geometryEntity.setPointName(nonGeometry.getPointName());
            geometryEntity.setGeom(wktToGeometry(nonGeometry.getGeom()));

            geometryEntity.getGeom().setSRID(3857);

            return geometryEntity;

        }

    public static Geometry wktToGeometry(String wellKnownText) throws ParseException {

            return new WKTReader().read(wellKnownText);
        }

There is any method such as wktToGeometry to do what I want?

Tags : geometry java wkt


Related Questions


Where is the open Java client for ArcGIS Server?

Updated May 27, 2015 00:09 AM

Point to Line Calculations

Updated March 13, 2016 08:09 AM


Add geometry line to the map

Updated November 17, 2018 09:22 AM

How can I convert bytes to geometry?

Updated December 16, 2016 08:09 AM