-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculated clipsrc area is too small for pdf to geojson ogr2ogr conversion #10335
Comments
If you use ogr2ogr you are playing with vector data, not pixels. You can check the extent of the PDF with ogrinfo
I thought that this would return the same output than without clipsrc However, it does not. There is something in the extents that I do not understand. Ogrinfo shows these extents: For the pdf:
For the without-clipsrc
For the with-clipsrc
Gdalinfo works in a rasterized world but it finds also different size for the document than what you calculated:
|
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
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 |
@rouault Upgrading gdal fixed it, thank you! |
What is the bug?
When I convert the attached pdf to geojson using ogr2ogr, the resulting geojson is on a very tiny area of the pdf.
-removed file-
Steps to reproduce the issue
Given the cropbox of the pdf:
And a dpi of 264, the dimensions of the pdf should be 9489px wide and 5065px high.
When I run the
ogr2ogr
command without theclipsrc
flag:I get a correct geojson file of the entire pdf.
-removed file-
But when I run it with the
clipsrc
flag with the a min and max that should span the entire pdf:I get a geojson file that spans just a small portion of the pdf.
-removed file-
I would expect the two commands to return almost equivalent geojson files.
Versions and provenance
OS: MacOS Sonoma 14.5
gdal: GDAL 3.8.4, released 2024/02/08
pdfinfo: pdfinfo version 24.01.0
Additional context
No response
The text was updated successfully, but these errors were encountered: