Help creating Local Coordinate projection for CAD data

984
9
10-16-2013 09:44 AM
DerrickPlotsky
New Contributor II
Hello,

I have some CAD data in an unknown local coordinate system that I have to get into a geodatabase in a State Plane coordinate system.  I have a CAD script that is currently being run to get do this from within AutoCAD, but I need to do this with Python instead now. I have some examples of the data in the State Plane coordinate system, but I am struggling as to how to find all of the parameters that I need to create the custom .prj file.

The script currently does:
1. Scale all -> 0,0 -> 1/12
2. Move all -> 18766.832,11612.104 -> 2829031.998,1017487.369
3. Rotate all -> 2829031.998,1017487.369 -> -30.0916403
4. Scale all -> 0,0 -> 0.9999129

I am unsure as to the best way to get the Easting, Northing, and Latitude and Longitude of Center. I think that the rotation and two scalings can be done by setting the rotation, units and scale factor. It is the rest that I am struggling to find.
Tags (2)
0 Kudos
9 Replies
RobertBorchert
Frequent Contributor III
I have done this numerous times. 

Start with something from your GIS that is in the proper projection.


Sections work good because then you can easily adjust the CAD drawing to proper world location.

Export the sections to a shape file.  Import them into CAD preserving the data and the projection.  Make sure your Shapefile has the .prj extension

once imported lock the sections layer.

add your autocad data as a block. 

Move it to the sections that a locked.

If you can this would be a good place to resize it and place it where it should go in the real world.

save the DWG.

run build and clean several times to get rid of the crud.

save the DWG.

Now you have choices.

First add the DWG into your ArcGIS session.  If everything lines up they way it should (and it should) then you can proceed to strip the cad and export it to your database.

Or you can export the DWG as a shapefile.  Save it to the original Sections shapefile you had imported.  This way it will give it the same projection as the shape file had as CAD will not export a .prj file without a predefined projection in cad.

FYI, I have spent many hours converting AutoCAD drawings to ArcGIS and most of the DWGs either had no projection or were simply very wrong. 

One system I converted was actually in the proper projection but whoever built it used millimeters or something to represent feet.  End result the system which spaned 30 x 50 miles was the size of third base when brought direct into ArcGIS

Hello,

I have some CAD data in an unknown local coordinate system that I have to get into a geodatabase in a State Plane coordinate system.  I have a CAD script that is currently being run to get do this from within AutoCAD, but I need to do this with Python instead now. I have some examples of the data in the State Plane coordinate system, but I am struggling as to how to find all of the parameters that I need to create the custom .prj file.

The script currently does:
1. Scale all -> 0,0 -> 1/12
2. Move all -> 18766.832,11612.104 -> 2829031.998,1017487.369
3. Rotate all -> 2829031.998,1017487.369 -> -30.0916403
4. Scale all -> 0,0 -> 0.9999129

I am unsure as to the best way to get the Easting, Northing, and Latitude and Longitude of Center. I think that the rotation and two scalings can be done by setting the rotation, units and scale factor. It is the rest that I am struggling to find.
0 Kudos
DerrickPlotsky
New Contributor II
Unfortunately I do not have CAD myself, so I am not able to do anything on the CAD side. I am provided with the DWGs that I have to get into State Plane from their local coordinate system. The script must go through the CAD data, export it, project it, and put it into an enterprise geodatabase.

But thank you for the suggestion.

I have done this numerous times. 

Start with something from your GIS that is in the proper projection.


Sections work good because then you can easily adjust the CAD drawing to proper world location.

Export the sections to a shape file.  Import them into CAD preserving the data and the projection.  Make sure your Shapefile has the .prj extension

once imported lock the sections layer.

add your autocad data as a block. 

Move it to the sections that a locked.

If you can this would be a good place to resize it and place it where it should go in the real world.

save the DWG.

run build and clean several times to get rid of the crud.

save the DWG.

Now you have choices.

First add the DWG into your ArcGIS session.  If everything lines up they way it should (and it should) then you can proceed to strip the cad and export it to your database.

Or you can export the DWG as a shapefile.  Save it to the original Sections shapefile you had imported.  This way it will give it the same projection as the shape file had as CAD will not export a .prj file without a predefined projection in cad.

FYI, I have spent many hours converting AutoCAD drawings to ArcGIS and most of the DWGs either had no projection or were simply very wrong. 

One system I converted was actually in the proper projection but whoever built it used millimeters or something to represent feet.  End result the system which spaned 30 x 50 miles was the size of third base when brought direct into ArcGIS
0 Kudos
RobertBorchert
Frequent Contributor III
When you open the AutoCAD drawing in ArcGIS does it come up in the proper geographic location?

I would suggest loading something first from the area then adding the DWG.

If it does then simply export the CAD features to a database.
0 Kudos
DerrickPlotsky
New Contributor II
It does not show up in the proper location. It shows up far away and is rotated differently.

When you open the AutoCAD drawing in ArcGIS does it come up in the proper geographic location?

I would suggest loading something first from the area then adding the DWG.

If it does then simply export the CAD features to a database.
0 Kudos
RobertBorchert
Frequent Contributor III
Can you use the Georeferencing ToolBar?  I am not certain if it requires a specific extension.

Add your CAD data to your drawing.

Zoom to the area where you KNOW your cad data should be.

From the Geoprocessing toolbar select the cad feature type you want to georeference and select fit to display.

then using knows referenced points from the CAD and the GIS use the Add Control Points on the toolbar to select a known CAD location first then the known place it should be.

The select a different CAD location (preferably some distance away) then the the the place it should be.

It does not show up in the proper location. It shows up far away and is rotated differently.
0 Kudos
MatthewFallau
New Contributor III
Do the mentioned procedures create a .prj for the local coordinate drawing or simply rectify said drawing to a known coordinate system (ie, unknown to state plane ****)? Based on the example listed, it seems that a planar transformation is created (based on a best fit) and not a projection (from a known geographic coordinate system to a local planar coordinate system).  If the process described does create a prj, it would be helpful to be able to save the settings and create a coordinate system for CAD imports from the same source.
0 Kudos
DerrickPlotsky
New Contributor II
Can you use the Georeferencing ToolBar?  I am not certain if it requires a specific extension.

Add your CAD data to your drawing.

Zoom to the area where you KNOW your cad data should be.

From the Geoprocessing toolbar select the cad feature type you want to georeference and select fit to display.

then using knows referenced points from the CAD and the GIS use the Add Control Points on the toolbar to select a known CAD location first then the known place it should be.

The select a different CAD location (preferably some distance away) then the the the place it should be.


I thought about doing this, but this has to be something that I can script, and I don't think I can script this. I had thought about creating a world file for one CAD dataset and then just using python to copy and paste it with different names (kind of a seed file) but hadn't tried it yet.
0 Kudos
DerrickPlotsky
New Contributor II
Do the mentioned procedures create a .prj for the local coordinate drawing or simply rectify said drawing to a known coordinate system (ie, unknown to state plane ****)? Based on the example listed, it seems that a planar transformation is created (based on a best fit) and not a projection (from a known geographic coordinate system to a local planar coordinate system).  If the process described does create a prj, it would be helpful to be able to save the settings and create a coordinate system for CAD imports from the same source.


The procedures just rectify it to a known coordinate system. I was hoping to create a .prj file that replicates the procedures in some way so that I can use it as an intermediary to get to the known coordinate system.
0 Kudos
DerrickPlotsky
New Contributor II
For anyone wondering, I was not able to get the projection file to work. It was not getting me close enough to what they currently have to be used. It might have worked eventually, but I did not have the time to fiddle with the numbers enough.

What I ended up doing was creating a world file once, and then using the fact that all of the data was in the same location to programmatically create a world file for every passed in dwg. I just used one file as a seed, and then created files with the same name as the dwg I am currently looking at.
0 Kudos