Codota Logo
Geometry.relate
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain Geometry
private void myMethod () {
Geometry g =
  • Codota IconGeometryCollection gc;gc.getGeometryN(n)
  • Codota IconSimpleFeature feature;(Geometry) feature.getDefaultGeometry()
  • Codota IconString wellKnownText;new WKTReader().read(wellKnownText)
  • Smart code suggestions by Codota
}
origin: com.vividsolutions/jts

/**
 * Tests whether the elements in the DE-9IM
 * {@link IntersectionMatrix} for the two <code>Geometry</code>s match the elements in <code>intersectionPattern</code>.
 * The pattern is a 9-character string, with symbols drawn from the following set:
 *  <UL>
 *    <LI> 0 (dimension 0)
 *    <LI> 1 (dimension 1)
 *    <LI> 2 (dimension 2)
 *    <LI> T ( matches 0, 1 or 2)
 *    <LI> F ( matches FALSE)
 *    <LI> * ( matches any value)
 *  </UL>
 *  For more information on the DE-9IM, see the <i>OpenGIS Simple Features
 *  Specification</i>.
 *
 *@param  g                the <code>Geometry</code> with which to compare
 *      this <code>Geometry</code>
 *@param  intersectionPattern  the pattern against which to check the
 *      intersection matrix for the two <code>Geometry</code>s
 *@return                      <code>true</code> if the DE-9IM intersection
 *      matrix for the two <code>Geometry</code>s match <code>intersectionPattern</code>
 * @see IntersectionMatrix
 */
public boolean relate(Geometry g, String intersectionPattern) {
 return relate(g).matches(intersectionPattern);
}
origin: com.vividsolutions/jts

public void run()
 throws ParseException
{
 GeometryFactory fact = new GeometryFactory();
 WKTReader wktRdr = new WKTReader(fact);
 String wktA = "POLYGON((40 100, 40 20, 120 20, 120 100, 40 100))";
 String wktB = "LINESTRING(20 80, 80 60, 100 140)";
 Geometry A = wktRdr.read(wktA);
 Geometry B = wktRdr.read(wktB);
 Geometry C = A.intersection(B);
 System.out.println("A = " + A);
 System.out.println("B = " + B);
 System.out.println("A intersection B = " + C);
 System.out.println("A relate C = " + A.relate(B));
}
origin: com.vividsolutions/jts

/**
 * Default implementation.
 */
public boolean containsProperly(Geometry g)
{
  // since raw relate is used, provide some optimizations
  
 // short-circuit test
 if (! baseGeom.getEnvelopeInternal().contains(g.getEnvelopeInternal()))
  return false;
  
 // otherwise, compute using relate mask
 return baseGeom.relate(g, "T**FF*FF*");
}
origin: com.vividsolutions/jts

return relate(g).isCovers();
origin: com.vividsolutions/jts

/**
 * Tests whether this geometry overlaps the
 * specified geometry.
 * <p>
 * The <code>overlaps</code> predicate has the following equivalent definitions:
 * <ul>
 * <li>The geometries have at least one point each not shared by the other
 * (or equivalently neither covers the other),
 * they have the same dimension,
 * and the intersection of the interiors of the two geometries has
 * the same dimension as the geometries themselves.
 * <li>The DE-9IM Intersection Matrix for the two geometries matches
 *   <code>[T*T***T**]</code> (for two points or two surfaces)
 *   or <code>[1*T***T**]</code> (for two curves)
 * </ul>
 * If the geometries are of different dimension this predicate returns <code>false</code>.
 *
 *@param  g  the <code>Geometry</code> with which to compare this <code>Geometry</code>
 *@return        <code>true</code> if the two <code>Geometry</code>s overlap.
 */
public boolean overlaps(Geometry g) {
 // short-circuit test
 if (! getEnvelopeInternal().intersects(g.getEnvelopeInternal()))
  return false;
 return relate(g).isOverlaps(getDimension(), g.getDimension());
}
origin: com.vividsolutions/jts

/**
 * Tests whether this geometry touches the
 * argument geometry.
 * <p>
 * The <code>touches</code> predicate has the following equivalent definitions:
 * <ul>
 * <li>The geometries have at least one point in common, but their interiors do not intersect.
 * <li>The DE-9IM Intersection Matrix for the two geometries matches
 * at least one of the following patterns
 *  <ul>
 *   <li><code>[FT*******]</code>
 *   <li><code>[F**T*****]</code>
 *   <li><code>[F***T****]</code>
 *  </ul>
 * </ul>
 * If both geometries have dimension 0, this predicate returns <code>false</code>.
 * 
 *
 *@param  g  the <code>Geometry</code> with which to compare this <code>Geometry</code>
 *@return        <code>true</code> if the two <code>Geometry</code>s touch;
 *      Returns <code>false</code> if both <code>Geometry</code>s are points
 */
public boolean touches(Geometry g) {
 // short-circuit test
 if (! getEnvelopeInternal().intersects(g.getEnvelopeInternal()))
  return false;
 return relate(g).isTouches(getDimension(), g.getDimension());
}
origin: org.geotools/gt2-main

static public boolean relatePattern(Geometry arg0,Geometry arg1,String arg2)
{
   Geometry _this = arg0;
   return _this.relate(arg1,arg2);
}
origin: com.vividsolutions/jts

/**
 * Tests whether this geometry crosses the
 * argument geometry.
 * <p>
 * The <code>crosses</code> predicate has the following equivalent definitions:
 * <ul>
 * <li>The geometries have some but not all interior points in common.
 * <li>The DE-9IM Intersection Matrix for the two geometries matches
 * one of the following patterns:
 *   <ul>
 *    <li><code>[T*T******]</code> (for P/L, P/A, and L/A situations)
 *    <li><code>[T*****T**]</code> (for L/P, A/P, and A/L situations)
 *    <li><code>[0********]</code> (for L/L situations)
 *   </ul>
 * </ul>
 * For any other combination of dimensions this predicate returns <code>false</code>.
 * <p>
 * The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations.
 * In order to make the relation symmetric,
 * JTS extends the definition to apply to L/P, A/P and A/L situations as well.
 *
 *@param  g  the <code>Geometry</code> with which to compare this <code>Geometry</code>
 *@return        <code>true</code> if the two <code>Geometry</code>s cross.
 */
public boolean crosses(Geometry g) {
 // short-circuit test
 if (! getEnvelopeInternal().intersects(g.getEnvelopeInternal()))
  return false;
 return relate(g).isCrosses(getDimension(), g.getDimension());
}
origin: com.vividsolutions/jts

return relate(g).isEquals(getDimension(), g.getDimension());
origin: org.geotools/gt-main

static public boolean relatePattern(Geometry arg0,Geometry arg1,String arg2)
{
   if (arg0 == null || arg1 == null || arg2 == null) return false;
   Geometry _this = arg0;
   return _this.relate(arg1,arg2);
}
origin: com.vividsolutions/jts

return relate(g).isContains();
origin: com.vividsolutions/jts

return relate(g).isIntersects();
origin: org.orbisgis/h2gis

/**
 * @param a Geometry Geometry.
 * @param b Geometry instance
 * @return 9-character String representation of the 2 geometries IntersectionMatrix
 */
public static String relate(Geometry a,Geometry b) {
  if(a==null || b==null) {
    return null;
  }
  return a.relate(b).toString();
}
origin: org.geotools/gt-main

static public String relate(Geometry arg0,Geometry arg1)
{
   if (arg0 == null || arg1 == null) return null;
   Geometry _this = arg0;
   return _this.relate(arg1).toString();
}
origin: org.geotools/gt2-main

static public String relate(Geometry arg0,Geometry arg1)
{
   Geometry _this = arg0;
   return _this.relate(arg1).toString();
}
origin: org.jboss.teiid/teiid-engine

public static Boolean relate(GeometryType geom1, GeometryType geom2, String intersectionPattern) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return g1.relate(g2, intersectionPattern);
}

origin: org.teiid/teiid-engine

public static Boolean relate(GeometryType geom1, GeometryType geom2, String intersectionPattern) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return g1.relate(g2, intersectionPattern);
}

origin: teiid/teiid

public static Boolean relate(GeometryType geom1, GeometryType geom2, String intersectionPattern) throws FunctionExecutionException {
  Geometry g1 = getGeometry(geom1);
  Geometry g2 = getGeometry(geom2);
  return g1.relate(g2, intersectionPattern);
}

origin: com.vividsolutions/jts-core

/**
 * Default implementation.
 */
public boolean containsProperly(Geometry g)
{
  // since raw relate is used, provide some optimizations
  
 // short-circuit test
 if (! baseGeom.getEnvelopeInternal().contains(g.getEnvelopeInternal()))
  return false;
  
 // otherwise, compute using relate mask
 return baseGeom.relate(g, "T**FF*FF*");
}
origin: BaseXdb/basex

 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
  final Geometry geo1 = checkGeo(0, qc);
  final Geometry geo2 = checkGeo(1, qc);
  final byte[] matrix = toToken(exprs[2], qc);
  try {
   return Bln.get(geo1.relate(geo2, Token.string(matrix)));
  } catch(final IllegalArgumentException ex) {
   Util.debug(ex);
   throw GEO_ARG.get(info, matrix);
  }
 }
}
com.vividsolutions.jts.geomGeometryrelate

Javadoc

Returns the DE-9IM IntersectionMatrix for the two Geometrys.

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

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • putExtra (Intent)
  • notifyDataSetChanged (ArrayAdapter)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • MalformedURLException (java.net)
    Thrown to indicate that a malformed URL has occurred. Either no legal protocol could be found in a s
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Stack (java.util)
    The Stack class represents a last-in-first-out (LIFO) stack of objects. It extends class Vector with
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now