Tabnine Logo
Geometry.toString
Code IndexAdd Tabnine to your IDE (free)

How to use
toString
method
in
com.vividsolutions.jts.geom.Geometry

Best Java code snippets using com.vividsolutions.jts.geom.Geometry.toString (Showing top 20 results out of 315)

origin: opentripplanner/OpenTripPlanner

public static EncodedPolylineBean createEncodings(Geometry geometry) {
  if (geometry instanceof LineString) {
    LineString string = (LineString) geometry;
    Coordinate[] coordinates = string.getCoordinates();
    return createEncodings(new CoordinateList(coordinates));
  } else if (geometry instanceof MultiLineString) {
    MultiLineString mls = (MultiLineString) geometry;
    return createEncodings(new CoordinateList(mls.getCoordinates()));
  } else {
    throw new IllegalArgumentException(geometry.toString());
  }
}
origin: com.vividsolutions/jts

 public String toString()
 {
   return baseGeom.toString();
 }
}
origin: org.geotools/gt-main

static public String toWKT(Geometry arg0)
{
   if (arg0 == null) return null;
   Geometry _this = arg0;
   return _this.toString();
}
origin: com.vividsolutions/jts-core

 public String toString()
 {
   return baseGeom.toString();
 }
}
origin: org.geotools/gt2-main

static public String toWKT(Geometry arg0)
{
   Geometry _this = arg0;
   return _this.toString();
}
origin: aseldawy/spatialhadoop2

@Override
public String toString() {
 return geom == null? "(empty)" : geom.toString();
}

origin: com.spatial4j/spatial4j

@Override
public String toString() {
 return geom.toString();
}
origin: harbby/presto-connectors

@Override
public String toString() {
 return geom.toString();
}
origin: org.geotools/gt-render

public String toString() {
  return geometry.toString();
}
origin: org.geotools/gt-main

  public void geometry(Geometry geometry) {
    System.out.println("here is the geometry: " + geometry.toString());
  }
}
origin: org.geotools/gt2-main

  public void geometry(Geometry geometry) {
    System.out.println("here is the geometry: " + geometry.toString());
  }
}
origin: FutureCitiesCatapult/TomboloDigitalConnector

private Map<String, Object> flattenSubject(List<Field> fields, Subject subject) {
  Map<String, Object> row = new HashMap<>();
  row.put("label", subject.getLabel());
  row.put("name", subject.getName());
  row.put("geometry", subject.getShape().toString());
  fields.stream().map(field -> getAttributeProperty(subject, field)).forEach(row::putAll);
  return row;
}

origin: org.geotools/gt-main

/**
 * Gets geometry.
 *
 * @param geometry The geometry from the filter.
 *
 * @throws IllegalFilterException If there are problems creating
 *         expression.
 */
public void geometry(Geometry geometry) throws IllegalFilterException {
  // Sets the geometry for the expression, as appropriate
  LOGGER.finer("got geometry: " + geometry.toString());
  //if(curExprssn.getType()==ExpressionDefault.LITERAL_GEOMETRY){
  //LOGGER.finer("got geometry: ");
  curExprssn = ff.createLiteralExpression();
  ((LiteralExpression) curExprssn).setLiteral(geometry);
  LOGGER.finer("set expression: " + curExprssn.toString());
  currentState = "complete";
  LOGGER.finer("set current state: " + currentState);
  //        }
}
origin: org.geotools/gt2-main

/**
 * Gets geometry.
 *
 * @param geometry The geometry from the filter.
 *
 * @throws IllegalFilterException If there are problems creating
 *         expression.
 */
public void geometry(Geometry geometry) throws IllegalFilterException {
  // Sets the geometry for the expression, as appropriate
  LOGGER.finer("got geometry: " + geometry.toString());
  //if(curExprssn.getType()==ExpressionDefault.LITERAL_GEOMETRY){
  //LOGGER.finer("got geometry: ");
  curExprssn = ff.createLiteralExpression();
  ((LiteralExpression) curExprssn).setLiteral(geometry);
  LOGGER.finer("set expression: " + curExprssn.toString());
  currentState = "complete";
  LOGGER.finer("set current state: " + currentState);
  //        }
}
origin: org.geotools/gt-main

SimpleFeature reproject(SimpleFeature feature) throws IOException {
  List attributes = feature.getAttributes();
  for (int i = 0; i < attributes.size(); i++) {
    Object object = attributes.get(i);
    if (object instanceof Geometry) {
      // do the transformation
      Geometry geometry = (Geometry) object;
      try {
        attributes.set(i, tx.transform(geometry));
      } catch (TransformException e) {
        String msg = "Error occured transforming "
            + geometry.toString();
        throw (IOException) new IOException(msg).initCause(e);
      }
    }
  }
  try {
    return SimpleFeatureBuilder.build(schema, attributes, feature.getID());
  } catch (IllegalAttributeException e) {
    String msg = "Error creating reprojeced feature";
    throw (IOException) new IOException(msg).initCause(e);
  }
}
origin: org.orbisgis/mapeditor

private ILayer createFenceLayer(Geometry g) {
    try(Connection connection = mc.getDataManager().getDataSource().getConnection();
      Statement st = connection.createStatement()) {
        boolean isH2 = JDBCUtilities.isH2DataBase(connection.getMetaData());
        String fenceLayer = getFenceLayerName(isH2);
        if(isH2) {
          st.execute("CREATE TABLE IF NOT EXISTS " + fenceLayer + " (THE_GEOM POLYGON)");
        } else {
          //PostGIS
          // TODO get SRID of the MapContext to build the fence
          st.execute("CREATE TABLE IF NOT EXISTS " + fenceLayer + " (THE_GEOM geometry(POLYGON,0))");
        }
        st.execute("DELETE FROM " + fenceLayer);
        st.execute("INSERT INTO " + fenceLayer + " VALUES (ST_PolyFromText('" + g.toString() + "', 0))");
        return mc.createLayer(fenceLayer);
    } catch (SQLException | LayerException e) {
        UILOGGER.error(i18n.tr("Cannot create fence layer"), e);
    }
    return null;
}
origin: org.wikibrainapi/wikibrain-spatial

public static void printLatLonPrecisions(String args[]){
  try {
    // do basic setup
    Env env = EnvBuilder.envFromArgs(args);
    Configurator c = env.getConfigurator();
    SpatialDataDao sdDao = c.get(SpatialDataDao.class);
    String[] articleNames = new String[] {"Alaska","Minneapolis","California","Germany"};
    Language lang = Language.SIMPLE;
    String layerName = Layers.WIKIDATA;
    for (String articleName : articleNames){
      Geometry g = sdDao.getGeometry(articleName, lang, layerName, Precision.LatLonPrecision.HIGH);
      if (g != null){
        System.out.printf(":-) Found high-precision geometry for '%s' (%s) in layer '%s': %s\n", articleName, lang.toString(), layerName, g.toString());
      }else{
        System.out.printf(":-( Could not find high-precision geometry for '%s' (%s) in layer '%s'\n", articleName, lang.toString(), layerName);
      }
    }
  }catch(Exception e){
    e.printStackTrace();
  }
}
origin: shilad/wikibrain

public static void printLatLonPrecisions(String args[]){
  try {
    // do basic setup
    Env env = EnvBuilder.envFromArgs(args);
    Configurator c = env.getConfigurator();
    SpatialDataDao sdDao = c.get(SpatialDataDao.class);
    String[] articleNames = new String[] {"Alaska","Minneapolis","California","Germany"};
    Language lang = Language.SIMPLE;
    String layerName = Layers.WIKIDATA;
    for (String articleName : articleNames){
      Geometry g = sdDao.getGeometry(articleName, lang, layerName, Precision.LatLonPrecision.HIGH);
      if (g != null){
        System.out.printf(":-) Found high-precision geometry for '%s' (%s) in layer '%s': %s\n", articleName, lang.toString(), layerName, g.toString());
      }else{
        System.out.printf(":-( Could not find high-precision geometry for '%s' (%s) in layer '%s'\n", articleName, lang.toString(), layerName);
      }
    }
  }catch(Exception e){
    e.printStackTrace();
  }
}
origin: org.orbisgis/h2drivers

/**
 * Convert JTS geometry to a kml geometry representation.
 *
 * @param geometry
 * @param extrude
 * @param altitudeModeEnum
 * @param sb
 */
public static void toKMLGeometry(Geometry geometry, ExtrudeMode extrude, int altitudeModeEnum, StringBuilder sb) throws SQLException {
  if (geometry instanceof Point) {
    toKMLPoint((Point) geometry, extrude, altitudeModeEnum, sb);
  } else if (geometry instanceof LineString) {
    toKMLLineString((LineString) geometry, extrude, altitudeModeEnum, sb);
  } else if (geometry instanceof Polygon) {
    toKMLPolygon((Polygon) geometry, extrude, altitudeModeEnum, sb);
  } else if (geometry instanceof GeometryCollection) {
    toKMLMultiGeometry((GeometryCollection) geometry, extrude, altitudeModeEnum, sb);
  } else {
    throw new SQLException("This geometry type is not supported : " + geometry.toString());
  }
}
origin: org.orbisgis/h2gis

/**
 * Convert JTS geometry to a kml geometry representation.
 *
 * @param geometry
 * @param extrude
 * @param altitudeModeEnum
 * @param sb
 */
public static void toKMLGeometry(Geometry geometry, ExtrudeMode extrude, int altitudeModeEnum, StringBuilder sb) throws SQLException {
  if (geometry instanceof Point) {
    toKMLPoint((Point) geometry, extrude, altitudeModeEnum, sb);
  } else if (geometry instanceof LineString) {
    toKMLLineString((LineString) geometry, extrude, altitudeModeEnum, sb);
  } else if (geometry instanceof Polygon) {
    toKMLPolygon((Polygon) geometry, extrude, altitudeModeEnum, sb);
  } else if (geometry instanceof GeometryCollection) {
    toKMLMultiGeometry((GeometryCollection) geometry, extrude, altitudeModeEnum, sb);
  } else {
    throw new SQLException("This geometry type is not supported : " + geometry.toString());
  }
}
com.vividsolutions.jts.geomGeometrytoString

Popular methods of Geometry

  • getEnvelopeInternal
    Gets an Envelope containing the minimum and maximum x and y values in this Geometry. If the geometr
  • getCoordinates
    Returns an array containing the values of all the vertices for this geometry. If the geometry is a c
  • isEmpty
    Tests whether the set of points covered by this Geometry is empty.
  • getCentroid
    Computes the centroid of this Geometry. The centroid is equal to the centroid of the set of componen
  • getGeometryN
    Returns an element Geometry from a GeometryCollection(or this, if the geometry is not a collection).
  • toText
    Returns the Well-known Text representation of this Geometry. For a definition of the Well-known Text
  • getNumGeometries
    Returns the number of Geometrys in a GeometryCollection(or 1, if the geometry is not a collection).
  • getFactory
    Gets the factory which contains the context in which this geometry was created.
  • getGeometryType
    Returns the name of this Geometry's actual class.
  • getSRID
    Returns the ID of the Spatial Reference System used by the Geometry. JTS supports Spatial Reference
  • getCoordinate
    Returns a vertex of this Geometry (usually, but not necessarily, the first one). The returned coordi
  • intersection
    Computes a Geometry representing the point-set which is common to both this Geometry and the other
  • getCoordinate,
  • intersection,
  • buffer,
  • contains,
  • getArea,
  • getEnvelope,
  • intersects,
  • union,
  • apply,
  • getLength

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getApplicationContext (Context)
  • addToBackStack (FragmentTransaction)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JTable (javax.swing)
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now