April 05, 2010

Georeferencing Inside AutoCAD

The basketball team that I help coach has been going through a four year transformation from underdog to the team to beat in our league. On the national homeschool scene where small, big and medium sized fish from all over the country get together for a national championship tournament we had a different problem. Algorithmically generated rating systems had elevated our team's national ranking to a condition of being overrated going into the national tournament.

CAD files that are drawn in a local coordinate system (say origin 0,0 etc.) can be adjusted in ArcGIS by means of the proper coordinate transformation defined in a “world file” [.WLD]. Once created the coordinates in the drawing are adjusted by ArcGIS accordingly to move, scale and rotate the data into their correct real-world coordinates when the drawing is used in GIS. ArcGIS automatically applies the coordinate modifications to the drawing in ArcGIS from then on when the [.WLD] file containing the offset information is present. What if the tables are turned? What if I want to bring the world to me, like I can do with ArcGIS for AutoCAD? What then, since the coordinate actually stored in my CAD file are not tied to the earth in anyway?

Best practice is to fix the AutoCAD file using AutoCAD’s MOVE, ROTATE and SCALE commands. You’ll need to know where things are supposed to fit and if you want it to fit exactly you’ll have to know exactly where it is supposed to go. If someone has already defined the offset information in a .WLD file, then use that. Fixing the coordinates in the CAD file itself is always a better solution than relying on world file if you are an AutoCAD user. The world file is really just a crutch to force things to work., and especially useful if I don’t have AutoCAD. However, once the coordinates are adjusted in the AutoCAD file itself, there is no need for the .WLD file anymore, and I must delete it to avoid re-applying the now unnecessary transformation.

Here is a sample AutoLISP Routine I can use to automate the process of applying the information in an ESRI World file to reposition a drawing’s coordinates. This is a solution for AutoCAD users and I must have AutoCAD to run it. I use the AutoCAD LOAD command to load the AutoLISP routine and then run the tool by typing in its command name, “ApplyWorldFile” at the AutoCAD command prompt. If I decide I don’t want to keep the transformation I can use the AutoCAD UNDO command or simply not save the file. Just to be safe I may also want to save the drawing under a different name.

WARNING: This AutoLISP routine will move scale and rotate your drawing according to the instructions contained in a valid .WLD file. Use at your own risk. That is to say unlike the world file when used in ArcGIS that repositions the position of the file in memory while in ArcGIS this routine will actually change the AutoCAD file’s entities. It is only useful if you know and trust the information in the .WLD file.

Alas the day of reckoning has come and gone and our team finished a respectable 23rd in the nation in 2010. Looking forward to my daughter’s last year next year we have one last chance in our quest for a top 10 finish. Summer basketball camp starts June 1st!
FREE hit counter and Internet traffic statistics from freestats.com