question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support QGIS GeoPDF format

See original GitHub issue

I downloaded a PDF from caltropo, opened it in TS and it worked perfectly, great!

However in my test file I generated with QGIS, using the following settings: image When I open it in TS it asks me to calibrate the file, so it seems parsing of the geopdf data is failing in some way.

I opened up the caltopo file in notepad++ and found the /GPTS line all nicely formatted:

8 0 obj
<<
/Type /Measure
/Subtype /GEO
/Bounds [0 1 0 0 1 0 1 1]
/LPTS [0 1 0 0 1 0 1 1]
/GPTS [45.057804 -75.91218 45.11057 -75.91218 45.11057 -75.851585 45.057804 -75.851585]
/GCS 22 0 R
/DCS 23 0 R
>>
endobj

However mine from QGIS has all this on one line:

6 0 obj
<< /GCS 7 0 R /GPTS [ 45.0780799698456534 -75.8550046364233737 45.0780799698456534 -75.8418074947041276 45.073006918482065 -75.8418074947041276 45.073006918482065 -75.8550046364233737 ] /LPTS [ 0 1 1 1 1 0 0 0 ] /Subtype /GEO /Type /Measure >>
endobj

I took a look at your commit: https://github.com/kylecorry31/Trail-Sense/commit/53d7a63ba048a4f85ee435118ab72f6294eff71d#diff-4dc068e24ecb002befa7409a57987ed88a5c89e53fb1f26cfab4cd1ceae83e56R55

And I believe your regex in the linked commit is too greedy, so it pulls in those /LPTS whatever those happen to be: image

However I butchered my pdf file a bunch attempting to get the /GPTS, /BBox, and /MediaBox lines to look similar to the caltropo one, and still couldn’t get TS to import the map. It shows the map correctly but it always asks to calibrate it.

Anyways, I’ve attached the pdf file here for you to try, I don’t quite see the issue. The pdf doesn’t seem to have an actual raster map (not sure why, next thing for me to debug in QGIS!) but it still has all the geo info in it.

test_modified.pdf test_orig.pdf

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kylecorry31commented, Apr 5, 2022

Support for this will be added in 3.9.0. @eresonance I verified it auto-calibrates when I import the test_orig.pdf you uploaded (and I also tested with my own QGIS map) - thanks for providing that!

1reaction
kylecorry31commented, Feb 12, 2022

Okay, thanks for the details - it looks like there are some unexpected nested << >> sections around the “Mediabox” - I’ll have to support that as well.

I’ll experiment with this during my next development cycle to see if I can get it to work on the PDF you provided.

Hope you enjoy your camping trip!

Read more comments on GitHub >

github_iconTop Results From Across the Web

QGIS – Creating a GeoPDF - Cadline Community
To export this map as a GeoPDF, from the Project menu choose Import/Export > Export Map to PDF. This provides options to: choose...
Read more >
QGIS 3.10 Loves GeoPDF! - North Road
At its most basic, Geospatial PDF is a standard extension to the PDF format which allows for vector spatial datasets to be embedded...
Read more >
Exporting layout to GeoPDF format using QGIS on Ubuntu 20.04
I'd like to export a layout in GeoPDF format using QGIS 3.12.3-București (1:3.12.3+32focal) installed on Ubuntu 20.04 Focal Fossa from ...
Read more >
Better support for georeferenced pdf · Issue #17588 - GitHub
The new USGS Topo geospatial PDF files have some pitfalls, that can be handled with GDAL, but not yet inside QGIS. Please refer...
Read more >
GeoPDF
This format was not designed for GIS applications, and does not work very well with GIS software. Some purists say that GeoPDF applies...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found