com.vividsolutions.jts.geom.Polygon.setSRID()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(164)

本文整理了Java中com.vividsolutions.jts.geom.Polygon.setSRID()方法的一些代码示例,展示了Polygon.setSRID()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Polygon.setSRID()方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Polygon
类名称:Polygon
方法名:setSRID

Polygon.setSRID介绍

暂无

代码示例

代码示例来源:origin: com.vividsolutions/jts

public Object parse(Handler arg, GeometryFactory gf) throws SAXException {
    // one child, either a coord
    // or a coordinate sequence
    
    if(arg.children.size()<1)
      throw new SAXException("Cannot create a polygon without atleast one linear ring");
    int srid = getSrid(arg.attrs,gf.getSRID());
    
    LinearRing outer = (LinearRing) arg.children.get(0); // will be the first
    List t = arg.children.size()>1?arg.children.subList(1,arg.children.size()):null;
    LinearRing[] inner = t==null?null:(LinearRing[]) t.toArray(new LinearRing[t.size()]);
    
    Polygon p = gf.createPolygon(outer,inner);
    
    if(p.getSRID()!=srid)
      p.setSRID(srid);
    
    return p;
  }
});

代码示例来源:origin: org.geotools/gt-render

public void setSRID(int SRID) {
  polygon.setSRID(SRID);
}

代码示例来源:origin: com.eas.platypus/platypus-js-common-utils

public static Polygon createPolygonWithHoles(Polygon aPolygon, Geometry[] aHoles, int aSrid) {
  Polygon polygon = createPolygonWithHoles(aPolygon, aHoles);
  polygon.setSRID(aSrid);
  return polygon;
}

代码示例来源:origin: org.orbisgis/h2gis-functions

/**
   * Creates a rectangular Polygon formed from the minima and maxima by the
   * given shell.
   * The user can set a srid.
   * @param xmin X min
   * @param ymin Y min
   * @param xmax X max
   * @param ymax Y max
   * @param srid SRID
   * @return Envelope as a POLYGON
   */
  public static Polygon makeEnvelope(double xmin, double ymin, double xmax, double ymax, int srid) {
    Polygon geom = makeEnvelope(xmin, ymin, xmax, ymax);
    geom.setSRID(srid);
    return geom;
  }
}

代码示例来源:origin: org.orbisgis/h2gis

/**
   * Creates a rectangular Polygon formed from the minima and maxima by the
   * given shell.
   * The user can set a srid.
   * @param xmin X min
   * @param ymin Y min
   * @param xmax X max
   * @param ymax Y max
   * @param srid SRID
   * @return Envelope as a POLYGON
   */
  public static Polygon makeEnvelope(double xmin, double ymin, double xmax, double ymax, int srid) {
    Polygon geom = makeEnvelope(xmin, ymin, xmax, ymax);
    geom.setSRID(srid);
    return geom;
  }
}

代码示例来源:origin: com.vividsolutions/jts-io

public Object parse(Handler arg, GeometryFactory gf) throws SAXException {
    // one child, either a coord
    // or a coordinate sequence
    
    if(arg.children.size()<1)
      throw new SAXException("Cannot create a polygon without atleast one linear ring");
    int srid = getSrid(arg.attrs,gf.getSRID());
    
    LinearRing outer = (LinearRing) arg.children.get(0); // will be the first
    List t = arg.children.size()>1?arg.children.subList(1,arg.children.size()):null;
    LinearRing[] inner = t==null?null:(LinearRing[]) t.toArray(new LinearRing[t.size()]);
    
    Polygon p = gf.createPolygon(outer,inner);
    
    if(p.getSRID()!=srid)
      p.setSRID(srid);
    
    return p;
  }
});

代码示例来源:origin: mstahv/spring-boot-spatial-example

private Polygon toPolygon(Bounds bounds) {
  GeometryFactory factory = new GeometryFactory();
  double north = bounds.getNorthEastLat();
  double south = bounds.getSouthWestLat();
  double west = bounds.getSouthWestLon();
  double east = bounds.getNorthEastLon();
  Coordinate[] coords = new Coordinate[]{new Coordinate(east, north), new Coordinate(east, south),
    new Coordinate(west, south), new Coordinate(west, north), new Coordinate(east, north)};
  // GeoDb does not support LinerRing intersection, but polygon ?!
  LinearRing lr = factory.createLinearRing(coords);
  Polygon polygon = factory.createPolygon(lr, null);
  polygon.setSRID(4326);
  return polygon;
}

代码示例来源:origin: org.geotools/gt-main

/**
   * Returns the completed OGC Polygon.
   *
   * @param geometryFactory Geometry factory to be used in Polygon creation.
   *
   * @return Completed OGC Polygon.
   */
  public Geometry create(GeometryFactory geometryFactory) {
    for (int i = 0; i < innerBoundaries.size(); i++) {
      LinearRing hole = (LinearRing) innerBoundaries.get(i);
      if (hole.crosses(outerBoundary)) {
        LOGGER.warning("Topology Error building polygon");

        return null;
      }
    }

    LinearRing[] rings =
      (LinearRing[]) innerBoundaries.toArray(new LinearRing[innerBoundaries.size()]);
    Polygon polygon = geometryFactory.createPolygon(outerBoundary,rings);
    polygon.setUserData( getSRS() );
    polygon.setSRID( getSRID() );
    return polygon;
  }
}

代码示例来源:origin: org.geotools/gt2-main

/**
   * Returns the completed OGC Polygon.
   *
   * @param geometryFactory Geometry factory to be used in Polygon creation.
   *
   * @return Completed OGC Polygon.
   */
  public Geometry create(GeometryFactory geometryFactory) {
    for (int i = 0; i < innerBoundaries.size(); i++) {
      LinearRing hole = (LinearRing) innerBoundaries.get(i);
      if (hole.crosses(outerBoundary)) {
        LOGGER.warning("Topology Error building polygon");

        return null;
      }
    }

    LinearRing[] rings =
      (LinearRing[]) innerBoundaries.toArray(new LinearRing[innerBoundaries.size()]);
    Polygon polygon = geometryFactory.createPolygon(outerBoundary,rings);
    polygon.setUserData( getSRS() );
    polygon.setSRID( getSRID() );
    return polygon;
  }
}

代码示例来源:origin: jzyong/game-server

polygon.setSRID(numPointsInAQuadrant);
Geometry bufferedGeometry = polygon.buffer(bufferAmount, numPointsInAQuadrant);
if (bufferedGeometry instanceof Polygon) {

代码示例来源:origin: org.hibernatespatial/hibernate-spatial

static public Polygon toPolygon(Envelope env, int SRID) {
  Coordinate[] coords = new Coordinate[5];
  coords[0] = new Coordinate(env.getMinX(), env.getMinY());
  coords[1] = new Coordinate(env.getMinX(), env.getMaxY());
  coords[2] = new Coordinate(env.getMaxX(), env.getMaxY());
  coords[3] = new Coordinate(env.getMaxX(), env.getMinY());
  coords[4] = new Coordinate(env.getMinX(), env.getMinY());
  LinearRing shell = geomFactory.createLinearRing(coords);
  Polygon pg = geomFactory.createPolygon(shell, null);
  pg.setSRID(SRID);
  return pg;
}

代码示例来源:origin: shizuchengxuyuan/net.sz.java

jtsPolygon.setSRID(numPointsInAQuadrant);
Geometry bufferedGeometry = jtsPolygon.buffer(bufferAmount, numPointsInAQuadrant);
if (bufferedGeometry instanceof com.vividsolutions.jts.geom.Polygon) {

代码示例来源:origin: org.geotools/gt-main

LOGGER.exiting("SubHandlerBox", "create", polygon);
polygon.setUserData( getSRS() );
polygon.setSRID( getSRID() );

代码示例来源:origin: org.geotools/gt2-main

LOGGER.exiting("SubHandlerBox", "create", polygon);
polygon.setUserData( getSRS() );
polygon.setSRID( getSRID() );

代码示例来源:origin: org.geotools/gt-oracle-spatial

poly.setSRID(SRID);

代码示例来源:origin: org.n52.series-api.db/dao

public Geometry getSpatialFilter() {
  BoundingBox spatialFilter = parameters.getSpatialFilter();
  if (spatialFilter != null) {
    CRSUtils crsUtils = CRSUtils.createEpsgForcedXYAxisOrder();
    Point ll = spatialFilter.getLowerLeft();
    Point ur = spatialFilter.getUpperRight();
    GeometryFactory geomFactory = crsUtils.createGeometryFactory(databaseSridCode);
    Envelope envelope = new Envelope(ll.getCoordinate(), ur.getCoordinate());
    Polygon geometry = JTS.toGeometry(envelope, geomFactory);
    geometry.setSRID(crsUtils.getSrsIdFromEPSG(databaseSridCode));
    return geometry;
  }
  return null;
}

相关文章