19

I was wondering if there was anyway to georeference a pdf directly without first converting it to an image. I have access to ArcGIS 10.1 but haven't been able to find any information that would indicate it is possible. I am willing to try other open source software if they have a solution.

I receive site plans in PDF form, often generated from AutoCAD. Currently I save the pdf as a jpg to import into ArcMap, geo-reference it, and then digitize things like building footprints. I'm just wondering if there is a way to skip the conversion to jpg step.

2
  • 4
    You might these interesting: georeference.org/forum/t112455 and gis.stackexchange.com/questions/9659/…
    – John
    Jan 31, 2013 at 16:38
  • 1
    Not quite your question, but if the original source is AutoCAD, ogr2ogr will convert dxf files to shape files. See this post for an example. Unfortunately the example does not cover the flags for geo-referencing, but the gdal-dev mailing list is very active and someone will quickly answer if you have a question about how to set up the geo-referencing flags.
    – Llaves
    Feb 4, 2013 at 4:58

6 Answers 6

6

I know this question is old, but I had this issue recently and eventually came out with a way to do this.

This can be accomplished by using Osgeo's gdal, which happens to have a PDF driver included. Basically you can do something like:

from osgeo import gdal
#Open your Unreferenced PDF
src = gdal.Open("originalFile.pdf")

Then obtain or calculate somehow the desired Projection System and Geotransform you want to add to the PDF. For example, we can extract those from a GeoTiff by doing:

#Open the Tiff to obtain its data from
geoTiff = gdal.Open("someMap.tif")
#Obtain its Projection system and its Geotransform
coords = geoTiff.GetProjection()
gt = geoTiff.GetGeoTransform()

Finally, set the projection and geotransform to your PDF and then create a copy with the PDF Driver:

src.SetProjection(coords)
src.SetGeoTransform(gt)
#Instantiate a PDF driver and save your Referenced copy
pdf_driver = gdal.GetDriverByName("PDF")
dst = pdf_driver.CreateCopy("referencedFile.pdf", src, 1)

The result is a PDF that is georeferenced to have its upper-left corner placed at location gt using the Projection System coords. This can be verified by opening the PDF on QGis or ArcGis, or well by using the gdalinfo command on your referenced PDF.

2
  • Thank you - this approach is kinda working but my resulting GeoPDF is too large, checking gdalinfo I see NEATLINE=POLYGON ((852044.603697945 6734631.62182539,852044.603697945 6697359.12182539,832204.603697945 6697359.12182539,832204.603697945 6734631.62182539,852044.603697945 6734631.62182539)) however my a_ullr for gdal_create is 852044.603697945 6734631.62182539 851724.603697945 6734206.62182539 any idea what is going wrong here? Using EPSG:3857 here, the GIST is gist.github.com/TimMcCauley/b72d430733c3e283a6b71e7e09aee40a Nov 8, 2021 at 20:44
  • @TimothyDalton hey there, glad this helped. By large you mean that the result is "stretched out"? Anyways, if you are obtaining the Geotransform from a .tiff file and your PDF is resulting that way, it would suggest that the problem is with your TIFF and its gt... Cheking your gist I see that you are calling a subprocess and doing gdal_translate after creating the PDF as I suggested... care explaining why? I don't call translate when doing the geopdf, perhaps that step is messing the result?
    – DarkCygnus
    Nov 8, 2021 at 20:52
5

At cost yes, http://mappingcenter.esri.com/index.cfm?fa=ask.answers&q=2237

TerraGo's ArcMap extension lets you both write and read GeoPDF files http://www.terragotech.com/products/terrago-publisher/publisher-for-arcgis

4
  • Does this work if I want to import a normal PDF, not a GeoPDF?
    – Sarah
    Jan 31, 2013 at 20:12
  • It will import normal pdf, there just will not be any spatial reference.
    – Mapperz
    Jan 31, 2013 at 20:42
  • 3
    Does the extension allow you to geo-reference the PDF?
    – Sarah
    Feb 1, 2013 at 12:34
  • This can also be done without cost :) check my answer below to see how
    – DarkCygnus
    Sep 5, 2018 at 21:13
3

One important thing to note: GeoPDF is not the same as Geospatial PDF.

Geospatial PDF is just an "ordinary" PDF equipped with some geospatial tags that are used to georeference the PDF (those tags are defined as Adobe's proposed geospatial extensions to ISO 32000).

I'm not sure if there's an open source solution for applying these tags to PDF. One open-source way would be to use a PDF library (I used iText for this purpose) and write the code yourself, but this is difficult, since there aren't many free Geospatial PDF viewers/readers that you could use to test the results and make sure the georeference is valid.

In my case I worked on a solution for preparing maps for Avenza's PDF maps store. I used GDAL for testing the resulting PDFs, but when I then submitted these maps (validated by GDAL) to Avenza, there were still some issues to be solved before their Geospatial PDF parser was able to swallow those maps.

1
  • Thanks but this seems a little more complicated than I am looking for. I was just wondering if there was a way to geo-reference a pdf to digitize features in arcmap.
    – Sarah
    Feb 1, 2013 at 20:05
2

The question is old, but I believe the method below is the easiest method. Uses gdal_edit to efficiently transform a PDF to a Geospatial PDF while keeping all vector data as vectors.

Open the OSGeo shell Navigate to the folder with your pdf Add CRS and upperleft-lowerright bounds of your pdf as shown below:

gdal_edit -a_srs EPSG:YOURCRS -a_ullr XMIN YMAX XMAX YMIN YOURDOCUMENT.pdf
1

You can use gdal_translate to convert the GeoPDF to a geo referenced tif file. The main difference between your method and this one is that the geo reference is maintained.

My command was:

gdal_translate --config GDAL_PDF_DPI 300 -co "TFW=YES" pdf_name.pdf tif_name.tif

Note that it hadn't work for me in Windows, so used the OSGeo-Live virtual machine.

I haven't tested this with many pdf type, but it worked great with the USGS one's.

1
  • Although this answer seems useful, it has nothing to do with what asked in the Question. OP has an ungeoreferenced PDF and wants to reference it (not to make a tiff from a georeferenced PDF). Would you mind clarifying your answer?
    – DarkCygnus
    Dec 21, 2017 at 19:04
1

Do this on a weekly basis with Global Mapper it's awesome reads PDF and GeoPDF GEOREFERENCE produce geopdf, jp2,geotif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.