Comments (3)
If you use ogr2ogr you are playing with vector data, not pixels. You can check the extent of the PDF with ogrinfo
ogrinfo --config OGR_PDF_READ_NON_STRUCTURED YES clipsrc-problem.pdf -al -so
Extent: (-51.548640, -14146.138422) - (54006.879028, 28800.419032)
I thought that this would return the same output than without clipsrc
-clipsrc -51.548640 -14146.138422 54006.879028 28800.419032
However, it does not. There is something in the extents that I do not understand. Ogrinfo shows these extents:
For the pdf:
Feature Count: 63161
Extent: (-51.548640, -14146.138422) - (54006.879028, 28800.419032)
For the without-clipsrc
Feature Count: 63161
Extent: (-90.717000, -24895.827000) - (95042.892000, 50685.936000)
For the with-clipsrc
Feature Count: 16590
Extent: (2345.217000, 225.514000) - (54006.879000, 28800.419000)
Gdalinfo works in a rasterized world but it finds also different size for the document than what you calculated:
gdalinfo clipsrc-problem.pdf
Driver: PDF/Geospatial PDF
Files: clipsrc-problem.pdf
Size is 5392, 2878
from gdal.
I don't reproduce the issue using GDAL master. The geojson files generated with or without clipsrc are of similar size (the clipped one is slightly smaller due to some invalid geometries, like lines reduced to one single point, being omitted), and they look identical (except the "frame" line of the unclipped file being removed, as expected) when opened in QGIS
$ ls -al without-clipsrc.geojson with-clipsrc.geojson
-rw-rw-r-- 1 even even 15017544 juin 29 17:53 with-clipsrc.geojson
-rw-rw-r-- 1 even even 16653048 juin 29 17:52 without-clipsrc.geojson
$ ogrinfo -al -so without-clipsrc.geojson
INFO: Open of `without-clipsrc.geojson'
using driver `GeoJSON' successful.
Layer name: content
Geometry: Unknown (any)
Feature Count: 63161
Extent: (-9.072000, -2489.583000) - (9504.289000, 5068.594000)
$ ogrinfo -al -so with-clipsrc.geojson
INFO: Open of `with-clipsrc.geojson'
using driver `GeoJSON' successful.
Layer name: content
Geometry: Unknown (any)
Feature Count: 53658
Extent: (234.522000, 21.891000) - (9482.474000, 5032.952000)
I believe that the fixes for the PDF driver that went in 3.9.1 to solve #9870, in particular 53895c7, were the key to fix the issue.
With 3.8, you can workaround the issue (for that particular file) by multiplying by 10 your -clipsrc values
from gdal.
@rouault Upgrading gdal fixed it, thank you!
from gdal.
Related Issues (20)
- WMTS: taking into account WGS84BoundingBox sometimes lead to requesting more than TileMatrixSet
- gdal2tiles.py with --xyz raises TypeError HOT 4
- ERROR: column s.consrc does not exist HOT 4
- `GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR` does nothing for JP2OpenJPEG
- `CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE` support
- `gdal2tiles` crashes if run with `--nodata-values-pct-threshold` but not `--excluded-values` HOT 1
- Support for GML ArcByCenterPoint tag HOT 7
- Option to set CRS of an OGR Layer HOT 1
- Warning 1: PROJ: proj_create_from_database: C:\Program Files\GDAL\projlib\proj.db contains DATABASE.LAY OUT.VERSION.MINOR = 2 whereas a number >= 3 is expected. It comes from another PROJ installation. HOT 2
- Update gdalinfo -json output to support STAC EO extension 2.0
- gdalwarp and vertical transform with Nodata in the transform grid HOT 4
- DXF: cannot read SPLINE without control points HOT 6
- Date type NULL values are treated as '0000/00/00' on PostgreSQL COPY import
- SpatialReference.EPSGTreatsAsNorthingEasting missing from Java bindings HOT 6
- Issue with construction of server path on the OAPIF driver HOT 3
- OGR SQL dialect: it is not possible to set the `\` (backslash) char as the escape char with the `ESCAPE` clause
- GDAL-3.9.1 compilation error
- PDS4 files disp:horizontal_display_direction label should be taken into account.
- C++ API documentation doesn't say which header files to include
- cmake --install installs Python bindings without RUNPATH set
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gdal.