Friday, October 9, 2009

Dxf (and Dwg) in JGrass?

In our engineers job we get in tought much too often with dwg and dxf data. And much too often I told myself (and was told by my colleague Silli) that I should finally port the dxf/dwg import tool that the old JGrass borrowed from the gvSig community.

And here is finally the first step. The dxf import:

1) got to the usual import menu and find the dxf/dwg import



2) choose dxf import and insert the dxf file to be imported and the new shapefile to be created. Since dxf has no idea about projection, choose also a projection for the imported data.




3) push finish and wait. One layer will be created for every internal layer of the dxf file, with the data type that better suits the jts type. In this case I only had a road network:




Now have to test other types and files. Then it's dwg funtime (I hate those proprietary formats!). And then it all goes into uDig. Still have to think how though, since the license of this plugin has to stay GPL because of its prior licensing. Hmmmm....

5 comments:

Tomas Cea said...

Hi folks!

I'm trying to add DXF plugin but I find a problem.

I downloaded eu.hydrologis.jgrass.vectorimportexport_1.0.0.200912042245.jar from http://jgrass.wiki.software.bz.it/jgrass/Vector_Import_Export_Plugin.

I put this .jar into my plugins folder /home/tomascea/jgrass/plugins

I restarted JGrass and i click to File/import/others...however I can't see anything about DXF or DWG.

I'm working with Ubuntu 9.10 and Java JRE 6.0.

Could you tell me some advice, please?

Tomas
Mail: tomas.cea@gmail.com

moovida said...

Hi Tomas, sorry for the late reply, I am abroad at the time.

which version of udig are you using? The ones listed in the website?
They should work.

Tomas Cea said...

Hi moovida!

I'm trying with jgrass-1.1.x-build20090802085024-linux.gtk.x86 that i found here: http://jgrass.wiki.software.bz.it/jgrass/Installation

On the other hand, I know it works with udig-1.2-M8.

Now, I would like to improve this plugin to use it with geotools2, directly. I would like to show a DXF file into a geotools map.

Do you know how can I do it?

Thanks!

moovida said...

Hi Tomas, this doesn't work with udig 1.1, it was made for 1.2.
Anyways, did you get my email, were I send you the link to the code that does that. With an easy copy and past you should be able to create your own geotools importer.

Tomas Cea said...

Thanks Andrea, I got it!

I wrote a SHP file from my DXF file, and i show it.
At the moment, that's enough!

thx