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


Java GeometryDescriptor.getCoordinateReferenceSystem方法代码示例

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


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

示例1: findDescription

import org.opengis.feature.type.GeometryDescriptor; //导入方法依赖的package包/类
public static ShapeFileDesc findDescription(File file) throws IOException {
        FileDataStore store = FileDataStoreFinder.getDataStore(file);
        SimpleFeatureType schema = store.getSchema();
        GeometryDescriptor geometryDescriptor = schema.getGeometryDescriptor();
        GeometryType type = geometryDescriptor.getType();
        CoordinateReferenceSystem coordinateReferenceSystem = geometryDescriptor.getCoordinateReferenceSystem();
        List<AttributeDescriptor> attributeDescriptors = schema.getAttributeDescriptors();
        List<String> labels = new ArrayList();
        for (AttributeDescriptor a : attributeDescriptors) {
            labels.add(a.getLocalName());
            //labels
            System.out.println(a.getLocalName());
        }
        //projection system
//        System.out.println(coordinateReferenceSystem.getCoordinateSystem().getName().toString());
        //type
        System.out.println(parseGeometry(type));
        double w = store.getFeatureSource().getBounds().getWidth();
        double h = store.getFeatureSource().getBounds().getHeight();

        return new ShapeFileDesc(coordinateReferenceSystem == null ? null : coordinateReferenceSystem.getCoordinateSystem().getName().toString(),
                parseGeometry(type), labels, Math.sqrt(w * w + h * h));
    }
 
开发者ID:skp703,项目名称:RainInterpolator,代码行数:24,代码来源:ParseShapefiles.java

示例2: reprojectFilter

import org.opengis.feature.type.GeometryDescriptor; //导入方法依赖的package包/类
private Query reprojectFilter(Query query) throws IOException {
    SimpleFeatureType nativeFeatureType = source.getSchema();
    final GeometryDescriptor geom = nativeFeatureType.getGeometryDescriptor();
    // if no geometry involved, no reprojection needed
    if(geom == null)
        return query;
    
    try {
        // default CRS: the CRS we can assume geometry and bbox elements in filter are
        // that is, usually the declared one, but the native one in the leave case
        CoordinateReferenceSystem defaultCRS = null;
        // we need to reproject all bbox and geometries to a target crs, which is
        // the native one usually, but it's the declared on in the force case (since in
        // that case we completely ignore the native one)
        CoordinateReferenceSystem targetCRS = null;
        CoordinateReferenceSystem nativeCRS = geom.getCoordinateReferenceSystem();
        if(srsHandling == ProjectionPolicy.FORCE_DECLARED) {
            defaultCRS = declaredCRS;
            targetCRS = declaredCRS;
            nativeFeatureType = FeatureTypes.transform(nativeFeatureType, declaredCRS);
        } else if(srsHandling == ProjectionPolicy.REPROJECT_TO_DECLARED) {
            defaultCRS = declaredCRS;
            targetCRS = nativeCRS;
        } else { // FeatureTypeInfo.LEAVE
            defaultCRS = nativeCRS;
            targetCRS = nativeCRS;
        }
        
        // now we apply a default to all geometries and bbox in the filter
        ISODefaultCRSFilterVisitor defaultCRSVisitor = new ISODefaultCRSFilterVisitor(ff, defaultCRS);
        Filter filter = query.getFilter() != null ? query.getFilter() : Filter.INCLUDE;
        Filter defaultedFilter = (Filter) filter.accept(defaultCRSVisitor, null);
        
        // and then we reproject all geometries so that the datastore receives
        // them in the native projection system (or the forced one, in case of force) 
        ISOReprojectingFilterVisitor reprojectingVisitor = new ISOReprojectingFilterVisitor(ff, nativeFeatureType);
        Filter reprojectedFilter = (Filter) defaultedFilter.accept(reprojectingVisitor, null);
        
        Query reprojectedQuery = new Query(query);
        reprojectedQuery.setFilter(reprojectedFilter);
        return reprojectedQuery;
    } catch(Exception e) {
        throw new DataSourceException("Had troubles handling filter reprojection...", e);
    }
}
 
开发者ID:STEMLab,项目名称:geoserver-3d-extension,代码行数:46,代码来源:ISOGeoServerFeatureSource.java

示例3: getSRS

import org.opengis.feature.type.GeometryDescriptor; //导入方法依赖的package包/类
public static SRS getSRS(GeometryDescriptor gd) throws KettleException {
	return new SRS(gd.getCoordinateReferenceSystem());
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:4,代码来源:GTUtils.java


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