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

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

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

origin: org.geotools/gt-main

static public Geometry interiorPoint(Geometry arg0)
{
   if (arg0 == null) return null;
   Geometry _this = arg0;
   return _this.getInteriorPoint();
}
origin: org.geotools/gt2-main

static public Geometry interiorPoint(Geometry arg0)
{
   Geometry _this = arg0;
   return _this.getInteriorPoint();
}
origin: org.orbisgis/h2gis-functions

  /**
   * @param geometry Valid Geometry instance
   * @return A Point that lie on the surface or null if input geometry is not a surface.
   */
  public static Geometry getInteriorPoint(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getInteriorPoint();
  }
}
origin: org.orbisgis/h2spatial

  /**
   * @param geometry Valid Geometry instance
   * @return A Point that lie on the surface or null if input geometry is not a surface.
   */
  public static Geometry getInteriorPoint(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getInteriorPoint();
  }
}
origin: org.orbisgis/h2gis

  /**
   * @param geometry Valid Geometry instance
   * @return A Point that lie on the surface or null if input geometry is not a surface.
   */
  public static Geometry getInteriorPoint(Geometry geometry) {
    if(geometry==null) {
      return null;
    }
    return geometry.getInteriorPoint();
  }
}
origin: org.geotools/gt-render

public Point getInteriorPoint() {
  return geometry.getInteriorPoint();
}
origin: BaseXdb/basex

 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
  return toElement(checkGeo(0, qc).getInteriorPoint(), qc);
 }
}
origin: org.teiid/teiid-engine

public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException {
  Geometry g = getGeometry(geom);
  Point point = g.getInteriorPoint();
  if (point == null) {
    return null;
  }
  return getGeometryType(point, geom.getSrid());
}

origin: org.geotools/gt-jts-wrapper

/**
 * Returns a point interior to the geometry.
 */
public final DirectPosition getRepresentativePoint() {
  com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry();
  com.vividsolutions.jts.geom.Point p = jtsGeom.getInteriorPoint();
  return JTSUtils.pointToDirectPosition(p, getCoordinateReferenceSystem());
}
origin: org.geotools/gt2-jts-wrapper

/**
 * Returns a point interior to the geometry.
 */
public final DirectPosition getRepresentativePoint() {
  com.vividsolutions.jts.geom.Geometry jtsGeom = getJTSGeometry();
  com.vividsolutions.jts.geom.Point p = jtsGeom.getInteriorPoint();
  return JTSUtils.pointToDirectPosition(p, getCoordinateReferenceSystem());
}
origin: teiid/teiid

public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException {
  Geometry g = getGeometry(geom);
  Point point = g.getInteriorPoint();
  if (point == null) {
    return null;
  }
  return getGeometryType(point, geom.getSrid());
}

origin: org.orbisgis/core-map

/**
 * Return one point for each geometry
 *
 * @param rs
 * @param fid
 * @param mt
 * @return
 * @throws ParameterException
 * @throws IOException
 * @throws SQLException
 */
public Point2D getPointShape(ResultSet rs, long fid, MapTransform mt, Geometry theGeom)
        throws ParameterException, IOException, SQLException {
    Geometry geom = getGeometry(rs, fid, theGeom);
    AffineTransform at = mt.getAffineTransform();
    Point point;
    try {
        point = geom.getInteriorPoint();
    } catch (TopologyException ex) {
        LOGGER.error("getPointShape :: TopologyException: ", ex);
        point = geom.getCentroid();
    }
    return at.transform(new Point2D.Double(point.getX(), point.getY()), null);
}
origin: org.jboss.teiid/teiid-engine

public static GeometryType pointOnSurface(GeometryType geom) throws FunctionExecutionException {
  Geometry g = getGeometry(geom);
  Point point = g.getInteriorPoint();
  if (point == null) {
    return null;
  }
  point.setSRID(geom.getSrid());
  return getGeometryType(point);
}

origin: org.geotools/gt2-render

  private static Geometry pointInGeometry(Geometry g) {
    if(g instanceof Polygon) {
      Point p = g.getCentroid();
      // if the geometry is heavily generalized centroid computation may fail and return NaN
      if(Double.isNaN(p.getX()) || Double.isNaN(p.getY()))
        return g.getFactory().createPoint(g.getCoordinate());
      if(!g.contains(p))
        try {
          return g.getInteriorPoint();
        } catch(Exception e) {
          // generalized geometries might make interior point go bye bye
          return p;
        }
      else
        return p;
    } else {
      return g.getCentroid();
    }
  }
}
origin: org.geotools/gt-render

private static Geometry pointInGeometry(Geometry g) {
  Point p = g.getCentroid();
  if(g instanceof Polygon) {
    // if the geometry is heavily generalized centroid computation may fail and return NaN
    if(Double.isNaN(p.getX()) || Double.isNaN(p.getY()))
      return g.getFactory().createPoint(g.getCoordinate());
    // otherwise let's check if the point is inside. Again, this check and "getInteriorPoint"
    // will work only if the geometry is valid
    if(g.isValid() && !g.contains(p)) {
      try {
        p = g.getInteriorPoint();
      } catch(Exception e) {
        // generalized geometries might make interior point go bye bye
        return p;
      }
    } else {
      return p;
    }
  }
  return p;
}

origin: org.n52.sensorweb.sos/inspire-api

/**
 * Get the point from samplingGeometry or featureOfInterest
 * 
 * @return The {@link Point}
 */
private Point getPoint() {
  Point point = null;
  if (isSetSpatialFilteringProfileParameter()) {
    Geometry geometry = getSpatialFilteringProfileParameter().getValue().getValue();
    point = geometry.getInteriorPoint();
    point.setSRID(geometry.getSRID());
  } else {
    if (getObservationConstellation().getFeatureOfInterest() instanceof AbstractSamplingFeature
        && ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()).isSetGeometry()) {
      Geometry geometry =
          ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()).getGeometry();
      point = geometry.getInteriorPoint();
      point.setSRID(geometry.getSRID());
    }
  }
  return point;
}
origin: mapplus/spatial_statistics_for_geotools_udig

  public SimpleFeature next() throws NoSuchElementException {
    SimpleFeature sourceFeature = delegate.next();
    for (Object attribute : sourceFeature.getAttributes()) {
      if (attribute instanceof Geometry) {
        // centroid or interior point
        Geometry geometry = (Geometry) attribute;
        Point center = geometry.getCentroid();
        if (useInside && shapeType == SimpleShapeType.POLYGON
            && !geometry.contains(center)) {
          center = geometry.getInteriorPoint();
        }
        attribute = center;
      }
      builder.add(attribute);
    }
    SimpleFeature nextFeature = builder.buildFeature(sourceFeature.getID());
    builder.reset();
    return nextFeature;
  }
}
origin: org.n52.shetland/shetland

/**
 * Get the point from samplingGeometry or featureOfInterest
 *
 * @return The {@link Point}
 */
private Point getPoint() {
  Point point = null;
  if (isSetSpatialFilteringProfileParameter()) {
    Geometry geometry = getSpatialFilteringProfileParameter().getValue().getValue();
    point = geometry.getInteriorPoint();
    point.setSRID(geometry.getSRID());
  } else {
    if (getObservationConstellation().getFeatureOfInterest() instanceof AbstractSamplingFeature
        && ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest())
            .isSetGeometry()) {
      Geometry geometry =
          ((AbstractSamplingFeature) getObservationConstellation().getFeatureOfInterest()).getGeometry();
      point = geometry.getInteriorPoint();
      point.setSRID(geometry.getSRID());
    }
  }
  return point;
}
origin: mapplus/spatial_statistics_for_geotools_udig

  public SimpleFeature next() throws NoSuchElementException {
    SimpleFeature sourceFeature = delegate.next();
    SimpleFeature nextFeature = builder.buildFeature(sourceFeature.getID());
    // transfer attributes
    transferAttribute(sourceFeature, nextFeature);
    // calculate xy coordinates
    Geometry g = (Geometry) sourceFeature.getDefaultGeometry();
    Point center = useInside ? g.getInteriorPoint() : g.getCentroid();
    if (transformer != null) {
      try {
        center.setUserData(sourceFeature.getFeatureType()
            .getCoordinateReferenceSystem());
        center = (Point) transformer.transform(center);
      } catch (TransformException e) {
        String msg = "Error occured transforming " + center.toString();
        LOGGER.log(Level.WARNING, msg);
      }
    }
    nextFeature.setAttribute(xField, center.getX());
    nextFeature.setAttribute(yField, center.getY());
    return nextFeature;
  }
}
origin: org.geoserver.extension/dxf-core

private void writeInsertWithAttributes(String layer, String ownerHandle, String name, SimpleFeature f) throws IOException {
  writeGroup(0, "INSERT");
  writeOwnerHandle(ownerHandle);
  writeHandle("Geometry");
  writeSubClass("AcDbEntity");
  writeLayer(layer);
  writeSubClass("AcDbBlockReference");
  writeGroup(66, "     1");
  writeName(name);
  Geometry geometry = (Geometry)f.getDefaultGeometry();
  Point intPoint = geometry.getInteriorPoint();
  writePoint(intPoint.getX(), intPoint.getY(), 0.0);
  writeAttributes(layer, ownerHandle, f);
  writeGroup(0, "SEQEND");
  writeHandle("Geometry");
  // String handle = getNewHandle("AttDef");
  // writeGroup(5, handle);
  writeOwnerHandle(ownerHandle);
  writeSubClass("AcDbEntity");
  writeLayer(layer);
}

com.vividsolutions.jts.geomGeometrygetInteriorPoint

Javadoc

Computes an interior point of this Geometry. An interior point is guaranteed to lie in the interior of the Geometry, if it possible to calculate such a point exactly. Otherwise, the point may lie on the boundary of the geometry.

The interior point of an empty geometry is POINT EMPTY.

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

  • Parsing JSON documents to java classes using gson
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • startActivity (Activity)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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