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

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

Best Java code snippets using com.vividsolutions.jts.geom.Geometry.setSRID (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

/**
 * Sets the SRID, if it was specified in the WKB
 *
 * @param g the geometry to update
 * @return the geometry with an updated SRID value, if required
 */
private Geometry setSRID(Geometry g, int SRID)
{
 if (SRID != 0)
  g.setSRID(SRID);
 return g;
}
origin: com.vividsolutions/jts-core

/**
 * Sets the SRID, if it was specified in the WKB
 *
 * @param g the geometry to update
 * @return the geometry with an updated SRID value, if required
 */
private Geometry setSRID(Geometry g, int SRID)
{
 if (SRID != 0)
  g.setSRID(SRID);
 return g;
}
origin: org.geotools.jdbc/gt-jdbc-db2

/**
 * Sets the SRID, if it was specified in the WKB
 *
 * @param g the geometry to update
 * @return the geometry with an updated SRID value, if required
 */
private Geometry setSRID(Geometry g)
{
 if (SRID != 0)
  g.setSRID(SRID);
 return g;
}
origin: org.geotools/gt-render

public void setSRID(int SRID) {
  geometry.setSRID(SRID);
}
origin: org.geomajas.plugin/geomajas-layer-hibernate

private Geometry asGeometry(Object geometry) {
  if (geometry instanceof Geometry) {
    Geometry geom = (Geometry) geometry;
    geom.setSRID(srid);
    return geom;
  } else {
    throw new IllegalStateException("Cannot handle " + geometry + " as geometry.");
  }
}
origin: org.orbisgis/h2spatial

/**
 * @param geometry Geometry instance
 * @return Geometry envelope
 */
public static Geometry getBoundary(Geometry geometry, int srid) {
  if(geometry==null) {
    return null;
  }
  Geometry geometryEnvelope = geometry.getBoundary();
  geometryEnvelope.setSRID(srid);
  return geometryEnvelope;
}
origin: org.orbisgis/h2gis

/**
 * @param geometry Geometry instance
 * @return Geometry envelope
 */
public static Geometry getBoundary(Geometry geometry, int srid) {
  if(geometry==null) {
    return null;
  }
  Geometry geometryEnvelope = geometry.getBoundary();
  geometryEnvelope.setSRID(srid);
  return geometryEnvelope;
}
origin: org.orbisgis/h2gis-functions

/**
 * @param geometry Geometry instance
 * @return Geometry envelope
 */
public static Geometry getBoundary(Geometry geometry, int srid) {
  if(geometry==null) {
    return null;
  }
  Geometry geometryEnvelope = geometry.getBoundary();
  geometryEnvelope.setSRID(srid);
  return geometryEnvelope;
}
origin: org.orbisgis/h2spatial

/**
 * @param geometry Geometry instance
 * @param srid input SRID
 * @return Geometry envelope
 */
public static Geometry getEnvelope(Geometry geometry, int srid) {
  if(geometry==null) {
    return null;
  }
  Geometry geometryEnvelope = geometry.getEnvelope();
  geometryEnvelope.setSRID(srid);
  return geometryEnvelope;
}
origin: org.orbisgis/h2gis-functions

/**
 * @param geometry Geometry instance
 * @param srid input SRID
 * @return Geometry envelope
 */
public static Geometry getEnvelope(Geometry geometry, int srid) {
  if(geometry==null) {
    return null;
  }
  Geometry geometryEnvelope = geometry.getEnvelope();
  geometryEnvelope.setSRID(srid);
  return geometryEnvelope;
}
origin: org.orbisgis/h2gis

/**
 * @param geometry Geometry instance
 * @param srid input SRID
 * @return Geometry envelope
 */
public static Geometry getEnvelope(Geometry geometry, int srid) {
  if(geometry==null) {
    return null;
  }
  Geometry geometryEnvelope = geometry.getEnvelope();
  geometryEnvelope.setSRID(srid);
  return geometryEnvelope;
}
origin: org.teiid/teiid-engine

public static GeometryType makeEnvelope(double xmin, double ymin,
    double xmax, double ymax, Integer srid) {
  Geometry geom = GEOMETRY_FACTORY.createPolygon(new Coordinate[] {new Coordinate(xmin, ymin), new Coordinate(xmin, ymax), new Coordinate(xmax, ymax), new Coordinate(xmax, ymin), new Coordinate(xmin, ymin)});
  if (srid != null) {
    geom.setSRID(srid);
  }
  return getGeometryType(geom);
}
origin: org.jboss.teiid/teiid-engine

public static GeometryType makeEnvelope(double xmin, double ymin,
    double xmax, double ymax, Integer srid) {
  Geometry geom = GEOMETRY_FACTORY.createPolygon(new Coordinate[] {new Coordinate(xmin, ymin), new Coordinate(xmin, ymax), new Coordinate(xmax, ymax), new Coordinate(xmax, ymin), new Coordinate(xmin, ymin)});
  if (srid != null) {
    geom.setSRID(srid);
  }
  return getGeometryType(geom);
}
origin: teiid/teiid

public static GeometryType makeEnvelope(double xmin, double ymin,
    double xmax, double ymax, Integer srid) {
  Geometry geom = GEOMETRY_FACTORY.createPolygon(new Coordinate[] {new Coordinate(xmin, ymin), new Coordinate(xmin, ymax), new Coordinate(xmax, ymax), new Coordinate(xmax, ymin), new Coordinate(xmin, ymin)});
  if (srid != null) {
    geom.setSRID(srid);
  }
  return getGeometryType(geom);
}
origin: matsim-org/matsim

/**
 * Allows to manually overwrite the coordinate reference system (e.g. if the
 * ZoneLayer is read from a shape file without crs information).
 * 
 * @param crs a coordinate reference system.
 */
public void overwriteCRS(CoordinateReferenceSystem crs) {
  this.crs = crs;
  this.srid = CRSUtils.getSRID(crs);
  for(Zone<?> zone : zones) {
    zone.getGeometry().setSRID(srid);
  }
}
origin: org.teiid/teiid-engine

public static GeometryType getGeometryType(Geometry jtsGeom, int srid) {
  jtsGeom.setSRID(srid);
  byte[] bytes = getBytes(jtsGeom, true);
  GeometryType result = new GeometryType(bytes, srid);
  result.setGeoCache(jtsGeom);
  return result;
}

origin: teiid/teiid

public static GeometryType getGeometryType(Geometry jtsGeom, int srid) {
  jtsGeom.setSRID(srid);
  byte[] bytes = getBytes(jtsGeom, true);
  GeometryType result = new GeometryType(bytes, srid);
  result.setGeoCache(jtsGeom);
  return result;
}

origin: org.hibernatespatial/hibernate-spatial-postgis

private Geometry convertGeometryCollection(GeometryCollection collection) {
  org.postgis.Geometry[] geometries = collection.getGeometries();
  com.vividsolutions.jts.geom.Geometry[] jtsGeometries = new com.vividsolutions.jts.geom.Geometry[geometries.length];
  for (int i = 0; i < geometries.length; i++) {
    jtsGeometries[i] = convert2JTS(geometries[i]);
    //TODO  - refactor this so the following line is not necessary
    jtsGeometries[i].setSRID(0); // convert2JTS sets SRIDs, but constituent geometries in a collection must have srid  == 0 
  }
  com.vividsolutions.jts.geom.GeometryCollection jtsGCollection = getGeometryFactory()
      .createGeometryCollection(jtsGeometries);
  return jtsGCollection;
}
origin: org.hibernatespatial/hibernate-spatial-postgis

private Geometry forceEmptyToGeometryCollection(Geometry jtsGeom) {
  Geometry forced = jtsGeom;
  if (forced.isEmpty()) {
    GeometryFactory factory = jtsGeom.getFactory();
    if (factory == null) {
      factory = HBSpatialExtension.getDefaultGeomFactory();
    }
    forced = factory.createGeometryCollection(null);
    forced.setSRID(jtsGeom.getSRID());
  }
  return forced;
}
origin: org.jboss.teiid/teiid-engine

public static GeometryType polygon(GeometryType geom, int srid) throws FunctionExecutionException {
  Geometry g = getGeometry(geom);
  if (!(g instanceof LineString)) {
    throw new FunctionExecutionException(QueryPlugin.Event.TEIID31207, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31207));
  }
  LineString ls = (LineString)g;
  Geometry result = GEOMETRY_FACTORY.createPolygon(ls.getCoordinateSequence());
  result.setSRID(srid);
  return getGeometryType(result);
}
com.vividsolutions.jts.geomGeometrysetSRID

Javadoc

Sets the ID of the Spatial Reference System used by the Geometry.

NOTE: This method should only be used for exceptional circumstances or for backwards compatibility. Normally the SRID should be set on the GeometryFactory used to create the geometry. SRIDs set using this method will not be propagated to geometries returned by constructive methods.

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
  • setContentView (Activity)
  • putExtra (Intent)
  • findViewById (Activity)
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
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