当前位置: 首页>>代码示例>>Java>>正文


Java ReferencedEnvelope.transform方法代码示例

本文整理汇总了Java中org.geotools.geometry.jts.ReferencedEnvelope.transform方法的典型用法代码示例。如果您正苦于以下问题:Java ReferencedEnvelope.transform方法的具体用法?Java ReferencedEnvelope.transform怎么用?Java ReferencedEnvelope.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.geometry.jts.ReferencedEnvelope的用法示例。


在下文中一共展示了ReferencedEnvelope.transform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setExtend

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
 * sets the viewport of the map to the given extend.
 *
 * @param envelope the extend
 */
public void setExtend(ReferencedEnvelope envelope) {
    try {
        envelope = envelope.transform(this.mapContent.getViewport()
                .getCoordinateReferenceSystem(), true);
        double xLength = envelope.getSpan(0);
        xLength = xLength * TEN_PERCENT;
        double yLength = envelope.getSpan(1);
        yLength = yLength * TEN_PERCENT;
        envelope.expandBy(xLength, yLength);
        bboxAction.resetCoordinates();
        mapPane.deleteGraphics();
        mapPane.setDisplayArea(envelope);
    } catch (FactoryException | TransformException e) {
        log.log(Level.SEVERE, e.getMessage(), e);
    }
}
 
开发者ID:gdi-by,项目名称:downloadclient,代码行数:22,代码来源:WMSMapSwing.java

示例2: createSearchEnv

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private ReferencedEnvelope createSearchEnv(final DirectPosition2D pos, final double radius) {
	final CoordinateReferenceSystem contextCRS = getMapContent().getCoordinateReferenceSystem();
	ReferencedEnvelope env = new ReferencedEnvelope(pos.x - radius, pos.x + radius, pos.y - radius, pos.y + radius,
			contextCRS);
	if (isTransformRequired()) {
		final Layer layer = layerRef.get();
		if (layer != null) {
			final CoordinateReferenceSystem layerCRS = layer.getFeatureSource().getSchema()
					.getCoordinateReferenceSystem();
			try {
				env = env.transform(layerCRS, true);
			} catch (final Exception ex) {
				throw new IllegalStateException(ex);
			}
		}
	}

	return env;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:20,代码来源:VectorLayerHelper.java

示例3: RasterizedSpatialiteLasLayer

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public RasterizedSpatialiteLasLayer( String title, ASpatialDb db, Integer tileSize, boolean transparentBackground,
        boolean doIntensity ) throws Exception {
    super(makeLevels(title, tileSize, transparentBackground, db, doIntensity));
    String plus = doIntensity ? INTENSITY : ELEVATION;
    this.layerName = title + " " + plus;
    this.setUseTransparentTextures(true);

    try {
        Envelope tableBounds = db.getTableBounds(LasSourcesTable.TABLENAME);
        GeometryColumn spatialiteGeometryColumns = db.getGeometryColumnsForTable(LasCellsTable.TABLENAME);
        CoordinateReferenceSystem dataCrs = CRS.decode("EPSG:" + spatialiteGeometryColumns.srid);
        CoordinateReferenceSystem targetCRS = DefaultGeographicCRS.WGS84;
        ReferencedEnvelope env = new ReferencedEnvelope(tableBounds, dataCrs);
        ReferencedEnvelope envLL = env.transform(targetCRS, true);

        centre = envLL.centre();
    } catch (Exception e) {
        e.printStackTrace();
        centre = CrsUtilities.WORLD.centre();
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:22,代码来源:RasterizedSpatialiteLasLayer.java

示例4: getBoundaryProduct

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public Product getBoundaryProduct() throws FactoryException, TransformException {
    final CoordinateReferenceSystem mapCRS = getTargetCRS();
    if (mapCRS != null) {
        final ReferencedEnvelope envelope = getTargetEnvelope();
        final Envelope mapEnvelope = envelope.transform(mapCRS, true);

        final double pixelSizeX = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_X);
        final double pixelSizeY = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_Y);
        final int w = MathUtils.floorInt(mapEnvelope.getSpan(0) / pixelSizeX);
        final int h = MathUtils.floorInt(mapEnvelope.getSpan(1) / pixelSizeY);

        final Product product = new Product("mosaic", "MosaicBounds", w, h);
        final GeoCoding geoCoding = new CrsGeoCoding(mapCRS,
                                                     w, h,
                                                     mapEnvelope.getMinimum(0),
                                                     mapEnvelope.getMaximum(1),
                                                     pixelSizeX, pixelSizeY);
        product.setSceneGeoCoding(geoCoding);

        return product;
    }
    return null;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:24,代码来源:MosaicFormModel.java

示例5: computeMosaicBounds

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
/**
 * STEP 3 methods
 */

private ReferencedEnvelope computeMosaicBounds() {
    final Rectangle2D initialBounds = new Rectangle2D.Double();
    initialBounds.setFrameFromDiagonal(this.westBound, this.southBound, this.eastBound, this.northBound);
    final ReferencedEnvelope boundsEnvelope = new ReferencedEnvelope(initialBounds, DefaultGeographicCRS.WGS84);
    try {
        return boundsEnvelope.transform(this.targetCRS, true);
    } catch (TransformException | FactoryException e) {
        throw new OperatorException(e);
    }
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:15,代码来源:S2tbxMosaicOp.java

示例6: workaround

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public static ReferencedEnvelope workaround(ReferencedEnvelope env, CoordinateReferenceSystem targetCRS) throws TransformException, FactoryException{
	if (targetCRS != null)		{
		return env.transform(targetCRS, true);
	} else{
		return env.transform(CRS.decode(defaultValue), true);
	}
	
}
 
开发者ID:52North,项目名称:uDig-SOS-plugin,代码行数:9,代码来源:TransformCRSWorkaroundDesc.java

示例7: expandToIncludeEnvelope

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private void expandToIncludeEnvelope( ReferencedEnvelope maxExtent, org.opengis.geometry.Envelope envelope ) {
    ReferencedEnvelope tmpExtent = new ReferencedEnvelope(envelope.getCoordinateReferenceSystem());
    DirectPosition ll = envelope.getLowerCorner();
    double[] coordinate = ll.getCoordinate();
    tmpExtent.expandToInclude(new Coordinate(coordinate[0], coordinate[1]));
    DirectPosition ur = envelope.getUpperCorner();
    coordinate = ur.getCoordinate();
    tmpExtent.expandToInclude(new Coordinate(coordinate[0], coordinate[1]));

    try {
        ReferencedEnvelope transformed = tmpExtent.transform(maxExtent.getCoordinateReferenceSystem(), true);
        maxExtent.expandToInclude(transformed);
    } catch (TransformException | FactoryException e) {
        e.printStackTrace();
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:17,代码来源:ImageGenerator.java

示例8: ImageMosaicNwwLayer

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public ImageMosaicNwwLayer( File imageMosaicShpFile, Integer tileSize, GeneralParameterValue[] gp,
        boolean removeSameColorImages ) throws Exception {
    super(makeLevels(imageMosaicShpFile, getRenderer(imageMosaicShpFile, gp), tileSize, removeSameColorImages));
    this.layerName = FileUtilities.getNameWithoutExtention(imageMosaicShpFile);

    ReferencedEnvelope envelope = OmsVectorReader.readEnvelope(imageMosaicShpFile.getAbsolutePath());
    ReferencedEnvelope envelopeLL = envelope.transform(DefaultGeographicCRS.WGS84, true);

    double w = envelopeLL.getMinX();
    double s = envelopeLL.getMinY();
    double e = envelopeLL.getMaxX();
    double n = envelopeLL.getMaxY();

    double centerX = w + (e - w) / 2.0;
    double centerY = s + (n - s) / 2.0;

    centerCoordinate = new Coordinate(centerX, centerY);

    this.setUseTransparentTextures(true);

}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:22,代码来源:ImageMosaicNwwLayer.java

示例9: click1

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
SimpleFeatureCollection click1(MapMouseEvent ev) throws Exception {
    // Construct a 3x3 pixel rectangle centred on the mouse click position
    java.awt.Point screenPos = ev.getPoint();
    
    Rectangle screenRect = new Rectangle(screenPos.x - 1, screenPos.y - 1, 3, 3);
    CoordinateReferenceSystem worldCRS = mapFrame.getMapContent().getCoordinateReferenceSystem();
    // Transform the screen rectangle into a bounding box in the 
    // coordinate reference system of our map content.
    AffineTransform screenToWorld = mapFrame.getMapPane().getScreenToWorldTransform();
    Rectangle2D worldRect = screenToWorld.createTransformedShape(screenRect).getBounds2D();
    ReferencedEnvelope worldBBox = new ReferencedEnvelope(worldRect, worldCRS);
    
    // transform from world to target CRS
    SimpleFeatureType schema = featureSource.getSchema();
    CoordinateReferenceSystem targetCRS = schema.getCoordinateReferenceSystem();
    String geometryAttributeName = schema.getGeometryDescriptor().getLocalName();
    
    ReferencedEnvelope bbox = worldBBox.transform(targetCRS, true, 10);
    
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

    // Option 1 BBOX
    Filter filter = ff.bbox(ff.property(geometryAttributeName), bbox);
    
    // Option 2 Intersects
    // Filter filter = ff.intersects(ff.property(geometryAttributeName), ff.literal(bbox));
    
    return featureSource.getFeatures(filter);
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:30,代码来源:FilterExamples.java

示例10: transformReferencedEnvelope

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
private void transformReferencedEnvelope() throws Exception {
    // transformReferencedEnvelope start
    CoordinateReferenceSystem sourceCRS = CRS.decode("EPSG:4326");
    ReferencedEnvelope envelope = new ReferencedEnvelope(0, 10, 0, 20, sourceCRS);
    
    // Transform using 10 sample points around the envelope
    CoordinateReferenceSystem targetCRS = CRS.decode("EPSG:23032");
    ReferencedEnvelope result = envelope.transform(targetCRS, true, 10);
    // transformReferencedEnvelope end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:11,代码来源:APIExamples.java

示例11: getReferenceEnvelope

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public static ReferencedEnvelope getReferenceEnvelope(
		final GridCoverage gridCoverage,
		final CoordinateReferenceSystem targetCrs ) {
	final CoordinateReferenceSystem sourceCrs = gridCoverage.getCoordinateReferenceSystem();
	final Envelope sampleEnvelope = gridCoverage.getEnvelope();

	final ReferencedEnvelope sampleReferencedEnvelope = new ReferencedEnvelope(
			new com.vividsolutions.jts.geom.Envelope(
					sampleEnvelope.getMinimum(0),
					sampleEnvelope.getMaximum(0),
					sampleEnvelope.getMinimum(1),
					sampleEnvelope.getMaximum(1)),
			gridCoverage.getCoordinateReferenceSystem());

	ReferencedEnvelope projectedReferenceEnvelope = sampleReferencedEnvelope;
	if ((targetCrs != null) && !targetCrs.equals(sourceCrs)) {
		try {
			projectedReferenceEnvelope = sampleReferencedEnvelope.transform(
					targetCrs,
					true);
		}
		catch (TransformException | FactoryException e) {
			LOGGER.warn(
					"Unable to transform envelope of grid coverage to " + targetCrs.getName(),
					e);
		}
	}
	return projectedReferenceEnvelope;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:30,代码来源:RasterUtils.java

示例12: initalize

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public GeoHashGrid initalize(ReferencedEnvelope srcEnvelope, SimpleFeatureCollection features) throws NoSuchAuthorityCodeException, TransformException, FactoryException {
    this.buckets = readFeatures(features);

    final String firstGeohash = buckets.isEmpty() ? null : (String) buckets.get(0).get("key");
    final int precision;
    if (firstGeohash == null || !isValid(firstGeohash)) {
        LOGGER.fine("No aggregations found or missing/invalid geohash key");
        precision = DEFAULT_PRECISION;
    } else {
        precision = ((String) buckets.get(0).get("key")).length();
    }

    cellWidth = GeoHash.widthDegrees(precision);
    cellHeight = GeoHash.heightDegrees(precision);

    if (srcEnvelope.getCoordinateReferenceSystem() != null) {
        srcEnvelope = srcEnvelope.transform(DefaultGeographicCRS.WGS84,false);
    }
    computeMinLonOffset(srcEnvelope);
    envelope = computeEnvelope(srcEnvelope, precision);

    boundingBox = new ReferencedEnvelope(envelope.getMinX()-cellWidth/2.0, envelope.getMaxX()+cellWidth/2.0,
            envelope.getMinY()-cellHeight/2.0, envelope.getMaxY()+cellHeight/2.0, DefaultGeographicCRS.WGS84);

    final int numCol = (int) Math.round((envelope.getMaxX()-envelope.getMinX())/cellWidth+1);
    final int numRow = (int) Math.round((envelope.getMaxY()-envelope.getMinY())/cellHeight+1);
    grid = new float[numRow][numCol];
    LOGGER.fine("Created grid with size (" + numCol + ", " + numRow + ")");

    if (emptyCellValue != 0) {
        for (float[] row: grid)
            Arrays.fill(row, emptyCellValue);
    }
    List<GridCell> cells = new ArrayList<>();
    buckets.stream().forEach(bucket -> {
        Number rasterValue =  computeCellValue(bucket);
        cells.add(new GridCell((String) bucket.get("key"), rasterValue));
        scale.prepareScale(rasterValue.floatValue());
    });
    cells.stream().forEach(cell -> updateGrid(cell.getGeohash(), cell.getValue()));
    LOGGER.fine("Read " + cells.size() + " aggregation buckets");
    return this;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:44,代码来源:GeoHashGrid.java

示例13: getBoundaryProduct

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public Product getBoundaryProduct() throws FactoryException, TransformException {
    final CoordinateReferenceSystem mapCRS = getTargetCRS();
    if (mapCRS != null) {
        final ReferencedEnvelope envelope = getTargetEnvelope();
        final Envelope mapEnvelope = envelope.transform(mapCRS, true);

        final double pixelSizeX = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_X);
        final double pixelSizeY = (Double) getPropertyValue(PROPERTY_PIXEL_SIZE_Y);
        final int w = MathUtils.floorInt(mapEnvelope.getSpan(0) / pixelSizeX);
        final int h = MathUtils.floorInt(mapEnvelope.getSpan(1) / pixelSizeY);

        final Product product = new Product("Multi-seize Mosaic", "MosaicBounds", w, h);
        final GeoCoding geoCoding = new CrsGeoCoding(mapCRS,
                                                     w, h,
                                                     mapEnvelope.getMinimum(0),
                                                     mapEnvelope.getMaximum(1),
                                                     pixelSizeX, pixelSizeY);
        product.setSceneGeoCoding(geoCoding);

        return product;
    }
    return null;
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:24,代码来源:S2tbxMosaicFormModel.java

示例14: readAndReprojectBounds

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public static ReferencedEnvelope readAndReprojectBounds( String path ) throws Exception {
    ReferencedEnvelope env = OmsVectorReader.readEnvelope(path);
    return env.transform(GPS_CRS, true);
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:5,代码来源:NwwUtilities.java

示例15: invertQuery

import org.geotools.geometry.jts.ReferencedEnvelope; //导入方法依赖的package包/类
public Query invertQuery(
        @DescribeParameter(name = "outputBBOX", description = "Georeferenced bounding box of the output") ReferencedEnvelope envelope,
        Query targetQuery, GridGeometry targetGridGeometry
        ) throws ProcessException {

    final BBOXRemovingFilterVisitor visitor = new BBOXRemovingFilterVisitor();
    Filter filter = (Filter) targetQuery.getFilter().accept(visitor, null);
    final String geometryName = visitor.getGeometryPropertyName();
    if (geometryName != null) {
        final BBOX bbox;
        try {
            if (envelope.getCoordinateReferenceSystem() != null) {
                envelope = envelope.transform(DefaultGeographicCRS.WGS84,false);
            }
            bbox = FILTER_FACTORY.bbox(geometryName, envelope.getMinX(), envelope.getMinY(), envelope.getMaxX(), envelope.getMaxY(),  "EPSG:4326");
        } catch (Exception e) {
            throw new ProcessException("Unable to create bbox filter for feature source", e);
        }
        filter = (Filter) FILTER_FACTORY.and(filter, bbox).accept(new SimplifyingFilterVisitor(), null);
        targetQuery.setFilter(filter);
    }

    final List<PropertyName> properties = new ArrayList<>();
    properties.add(FILTER_FACTORY.property("_aggregation"));
    targetQuery.setProperties(properties);
    return targetQuery;
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:28,代码来源:GeoHashGridProcess.java


注:本文中的org.geotools.geometry.jts.ReferencedEnvelope.transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。