Hi,
You can use gdal.VectorTranslate with the same options that ogr2ogr utility supports https://gdal.org/programs/ogr2ogr.html. That includes -clipsrc [xmin ymin xmax ymax]|WKT|datasource|spat_extent "Clip geometries to the specified bounding box (expressed in source SRS), WKT geometry (POLYGON or MULTIPOLYGON), from a datasource or to the spatial extent of the -spa.. option if you use the spat_extent keyword. When specifying a datasource, you will generally want to use it in combination of the -clipsrclayer, -clipsrcwhere or -clipsrcsql options". In addition, with the SQLite dialect https://gdal.org/user/sql_sqlite_dialect.html you can do for any datasource almost anything that is possible with the SpatiaLite functions http://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html, including ST_Intersection http://www.gaia-gis.it/gaia-sins/spatialite-sql-latest.html. -Jukka Rahkonen- Yang wrote > I am using OpenFileGDB driver to read .gdb data through the java > binding,core codes: > > > Layer layer = > dataSource.GetLayer("layer_name"); > > layer.SetSpatialFilterRect(minx,miny,maxx,maxy); > System.out.println(layer.GetFeatureCount()); > layer.ResetReading(); > Feature feature = layer.GetNextFeature(); > while (feature != null) { > feature = > layer.GetNextFeature(); > // > } > > > > Now for a given feature I want to get the intersection geometry from the > bounding box (the same as that used in the spatial filter), when using > PostGIS, I can do that by > > > select ST_Intersect(geom,bbox) as clipped_geom from xx where geom > && bbox. > > > So when using OpenFileGDB: > > > 1 Can it do the intersection during the querying? > > > 2 If not, does it mean I have to do the clip in java by myself? Does gdal > provide some api? > _______________________________________________ > gdal-dev mailing list > [email protected] > https://lists.osgeo.org/mailman/listinfo/gdal-dev -- Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html _______________________________________________ gdal-dev mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/gdal-dev
