Transforming DWG to MBTiles

I am trying to find out an good method to transform several DWG (CAD) files to MBTiles raster format for indoor mapping purposes.

I managed to transform a few, but currently the process is very time consuming. What I currently do goes as follows:

  • I use FME to select only the relevant parts from the DWG files (walls, elevators etc.) and save it as a (Geo)PDF
  • I need to manually do some modifications (add some images etc) to the PDF’s to make them more readable and I do this in Adobe Illustrator)
  • I use ArcMap to transform the PDF’s to GeoTIFF’s, but it seems that the editing in Illustrator has lost the GeoPDF’s projection, which means that I also have to define a projection for the files.
  • Then I use gdal_edit to move and scale the files (I move it close to coordinates 0 & 0 and so that the map is approximately in the right scale. Before gdal_edit, one building is about 20 000 km wide when projected to pseudo Mercator). The projection isn’t really key here, as long as the maps are all in the same projection and alligned on top of each other, so not quite sure about this part…
  • Finally I add the files individually to Tilemill and export them as MBTiles. I only want to change the format, so is this really the way to do it? I am quite new still with Tilemill.

As you can see, I have a lot of tools at hand, but probably I am not using them in the most efficient way.Any ideas on how to streamline the process?

Is it possible to export geospatial PDF from QGIS via GDAL/OGR?

Is there any plugin for QGIS which would help me in exporting the map document as a geospatial PDF (similar to Terrago’s GeoPDF)?

How to have GDAL print layers of GeoPDF AND say which are raster vs vector

My Objective: I would like to use GDAL to convert a GeoPDF. I want the vector layers as shp files and the raster layers as tif files. I want to do this in a programmatic way.

Edit: In reality, I want to do this with many geospatial PDFs. I’m prototyping the workflow using Python, but it will probably end up being C++. (End Edit)

The Problem: Naturally, the command to convert a vector layer differs from a raster layer. And I don’t know (again in a programmatic way) which layers are vector and which are raster.

What I’ve Tried: First, here is my sample data

gdalinfo webmap_urbansample.pdf -mdd LAYERS

gives the layer names:

Metadata (LAYERS):                           

I know to look at the data which are vector and which are raster, but I don’t know how to parse this information to know whether to use ogr2ogr or gdal_translate to do the conversion.

Then I thought I could use ogrinfo and just diff all the layers to deduce which ones are raster, but ogrinfo gives me:

1: Cadastral Boundaries (Polygon)
2: Water Lines (Line String)
3: Sewerage Lines (Line String)
4: Sewerage Jump-Ups (Line String)
5: Roads
6: Water Points (Point)
7: Sewerage Pump Stations (Point)
8: Sewerage Man Holes (Point)
9: BPS - Buildings (Polygon)
10: BPS - Facilities (Polygon)
11: BPS - Water Sources (Point)

So there’s not a one-to-one correspondence with the way these are output.

So my question is: Does anyone know how to have gdal print the GeoPDF layers and indicate which are raster vs. vector? Or is there another way to infer this?


Adding PDF (especially GeoPDF) to ArcMap as data?

I receive a lot of PDF maps (vector, image, with georeference and without) and I am having to convert them to an image file before I can add them to ArcMap and georeference.

I can’t see any obvious out-of-the-box utility that would allow me to add and georeference a PDF directly without having to convert to an image file first.

Any ideas?

How do I verify a file is a GeoPDF?

I received some files from a third party that are supposed to be geoPDF. Is there a way to open a file (programmatically with .NET or Python, with a text editor, etc.) and verify it was created as a geoPDF? Does a geoPDF have bytes or an internal structure we can check?

Using GDAL translate in Pythonwin

I want GDAL translate in Pythonwin to process some GeoPDFs to GeoTiffs. I can’t call up GDAL module in Pywin. I used the OSGeo4 installer for original GDAL install and can leverage GDAL properly from the OSGeo4W.bat file.

My Python and Pywin are from an install of Arc 10.2.2. I created a PythonPath User variable and added C:Python27ArcGIS10.2;C:Python27ArcGIS10.2Lib;C:Python27ArcGIS10.2DLLs;C:Python27ArcGIS10.2Liblib-tk;C:OSGeo4W;C:OSGeo4Wlib;C:OSGeo4Wlibtk8.5;C:OSGeo4Wbin

After a reboot I still can’t call up the OSgeo/GDAL module.

While I would like to use GDAL commands in Pythonwin, I have also tried the work around

os.system("gdal_translate -of GTiff " + sourcefile + " " + destinationfile)

which is launching cmd prompts but not processing the files.

Can someone help with sorting out the GDAL module in Pywin or to clue me in on why the os.system command is not calling up GDAL translate.

Is it possible to export GeoPDF from QGIS?

Is there any plugin for QGIS which would help me in exporting the map document as a GeoPDF ?

Historical U.S.G.S. Georeferencing

I have downloaded a historical USGS map that is suppose to be a geoPDF. My understanding is that QGIS cannot directly read geoPDF’s. I have not had any luck in converting it to a geoTIF in order to bring into QGIS.

  1. Has anyone had any success in doing this? Is there another way that
    someone knows to use the geoPDF with QGIS.

  2. I converted the geoPDF to a TIF and attempted to use the
    georeferencer plug-in. Everytime I try doing it te results are not
    correct.Georeferender screenshot Georeferencer result

Cropping and transforming geoPDF with GDALwarp

I got some great advice on how to transform a geoPDF to a geoTIF on this post, which used the available downloads from this site. I would like to take it a little further and not only convert, but remove the border of historical USGS maps in order to be able to tile them in QGIS. Being a basic GIS user, I get lost in the “coding” involved to implement these practices.

How can I convert and crop historical USGS maps so they can be tiled in QGIS?

Thank you in advance for the insight.

How do I remove the orthoimage layer from the new USGS geospatial PDF topo maps

I would like to remove the orthoimage layer from a USGS topo geoPDF map. I have Adobe Acrobat Pro 9, but can’t find a way to delete a layer. I’ve tried setting the layer to “Never export”, then exporting the pdf, but the image is still there (and in the process I have somehow deleted the geo-referencing info.)


Question and Answer is proudly powered by WordPress.
Theme "The Fundamentals of Graphic Design" by Arjuna
Icons by FamFamFam