Importing vectors from Illustrator into a GIS with georeferencing

Having read various forums with software-biased comments such as the best way is to digitise linework in a GIS to then be able to use it in that GIS, I decided to share a method that actually answers the question!

Digitising in GIS software has improved a lot but many people prefer creating vectors – specifically creating lines using Bezier curves – in Adobe Illustrator, and I am very much in the camp of using the best or personally-preferred tool for each particular task. In my opinion if you cannot then get this into xGIS then it is a weakness of that GIS product not a poor methodology.

One method is to use the MAPublisher plug-in. But here I shall show you an alternative and simple ‘work around’:

1) Open a relevant georeferenced raster base map with known coordinates into Illustrator
(For example I loaded a 5km x 5km raster tile from OS VectorMap Local)

2) Digitise your route, or create whatever vectors you wish, in Illustrator using the base map or a known reference as your guide

3) Rename each layer to something useful for your GIS, e.g. I had 20 or so different off-road routes and I created each one on a separate layer in Illustrator and renamed it with the route name

4) Delete or turn off the raster

5) Export the required vector artwork as a DXF file, mine was called Routes.dxf

6) Make a note of the X and Y page coordinates of the top-left and bottom-right corners of the artboard

Option A – FME

Next we create a World File:

7) Open a text editor (e.g. TextPad, Notepad, etc.) and on the first line type the top-left coordinate of the artboard as X,Y but ignore the likely negative sign before the Y coordinate. Then type a space and enter the top-left (NW) coordinates of the known raster map again as X,Y

8) On the second line type the bottom-right coordinate of the artboard as X,Y but ignore the likely negative sign before the Y coordinate. Then type a space and enter the bottom-right (SE) coordinates of the known raster map again as X,Y

Your code should look like this:

Artboard top-left X, Artboard top-left Y Map top-left X, Map top-left Y
Artboard bottom-right X, Artboard bottom-right Y Map bottom-right X, Map bottom-right Y

For example mine read:

24,67 310000,830000
74,17 315000,825000

9) Save this as All Files and call it Routes.wld, ensuring it is saved or moved into the same folder as the Routes.dxf. If you have used different names then just ensure they are the same

Finally we create shapefiles:

10) In FME, load the DXF file with a reader and in the properties ensure that the ‘Read World File’ checkbox is ticked

Simply write to an ESRI Shapefile (SHP) writer, a shapefile will be produced for each layer
Option B – OSGeo4W/GDAL

7) Alternatively in GDAL, for example using the OSGeo4W Shell, use the ogr2ogr command and repeat this code for each layer:

ogr2ogr -where "LAYER='LayerName'" -f "ESRI Shapefile" LayerName.shp -a_srs EPSG:27700 -gcp page_minX page_minY map_minX map_minY -gcp page_minX page_maxY map_minX map_mmaxY -gcp page_maxX page_minY map_maxX map_minY -gcp page_maxX page_maxY map_maxX map_maxY Routes.dxf

Where page_X and page_Y are the values from the artboard in Illustrator as before, once again ignore the likely negative sign before the Y coordinate (from Illustrator); and map_X and map_Y are the coordinates of the base map or known points (in my case in British National Grid).

If you are outside of Great Britain then replace EPSG with the correct EPSG projection for your country or dataset.

For further clarity, my exact command was as follows:

ogr2ogr -where "LAYER='FreerideAlley'" -f "ESRI Shapefile" C:\Projects\Off_road_routes\data\routes\FreerideAlley.shp -a_srs EPSG:27700 -gcp 24 17 310000 825000 -gcp 24 67 310000 830000 -gcp 74 17 315000 825000 -gcp 74 67 315000 830000 C:\Projects\Off_road_routes\data\routes\Routes.dxf


i. unlike FME, GDAL always treats DXF as unreferenced so the world file would be ignored

ii. GDAL supposedly reads DXF in inches but I found this command uses whatever your original Illustrator map units were, in my case centimetres (cm)

iii. If you get an error around ‘unable to open with the following drivers’ ensure you have full filepaths in your command

iv. This code will not retain any styles from Illustrator

These shapefiles should now load correctly into your GIS software of choice.


Leave a Reply

Your email address will not be published. Required fields are marked *


Get every new post on this blog delivered to your Inbox.

Join other followers: