I would like to extract the coordinates (latitude, longitude) and some properties like name and colour of Autocad files. I may do this from a Java program.
From Autocad, which is the right format to export to so I can programmatically parse the file, look for objects and get their properties? (coordinates, name, colour...)
I know Autocad DWG format is a propietary binary file that changes its format every 3 years, so I need to find a file format to export to that allow me to read it easily.
Thanks!
DXF is what you're looking for. It's a documented format for drawing exchange in plain text.
http://images.autodesk.com/adsk/files/acad_dxf0.pdf
DXF is definitely the best format if you're not using a vertical product like Civil or Map. Some vertical products can also export SHP/SHX (shape) files.
Here's references for DXF: http://en.wikipedia.org/wiki/AutoCAD_DXF, http://images.autodesk.com/adsk/files/acad_dxf0.pdf
Here's a SHP reference: http://en.wikipedia.org/wiki/Shapefile
Related
Requirement:
I have to read dxf files entities which can be 2D building dimensions or road etc. Then i have to place it over the map and return the coordinates just like labs.mapbox.com export the coordinates as geojson like the data below export by labs.mapbox.
Approch: For now i'm using python 'exdxf' package to read dxf file which return me entities information e.g in case of line it would be start/end points. Then i was thinking to draw those entities over a canvas (not sure) then place it over mapbox and get the coordinates where canvas is place export geojson of it is the final goal.
Required help in: Suggest me the right way to achieve this solution, i am open to choose any framework / language.
Thanks for your time
If you've got a dxf file and want to export it as a geosjon file, using ezdxf python package is good but you have to do a lot of processing the dxf entities and stuff and it takes time to achieve what you want.
I suggest using ogr2ogr since this is a time saving approach. it is a library for working with geospatial data and you can convert data to different formats such as Geojson, shapefile and others.
you can easily convert your dxf file to a geojson file with :
ogr2ogr -f Geojson GEOJSON_FILE_NAME YOUR_DXF_FILE_NAME
I suggest reading the documentation
first to get to know about this library and all the options it gives you for processing the data.
I suppose there may not be a precise answer to this question, but perhaps I can at least understand working with DXF files better...
I need to process DXF files (floor plans) and link the label, which is usually a room name, to the entity representing the specific room.
I have checked the DXF file and there seems to be no link between the two entities. The TEXT entity has a unique handle (code 5) and it has a soft pointer to another object (I think to the general block definition - code 330) but that is not it. So my questions would be:
do I assume correctly that the only way in this case is to compare the coordinates of the label to coordinates of the "nearest" geometry object? This is doable but what if there are a few overlapping objects - I could see some potential risks there.
Is there a way to include a "precise" link from a text entity to a geometry entity in AutoCAD or similar tools? Perhaps with the use of some attributes? My knowledge of DXF is minimal at this point so if anyone could point me to some documentation or example .dxf files where such "precise link" thing is included, it would be great.
Many thanks!
Is there a way to include a "precise" link from a text entity to a geometry entity in AutoCAD or similar tools? Perhaps with the use of some attributes? My knowledge of DXF is minimal at this point so if anyone could point me to some documentation or example .dxf files where such "precise link" thing is included, it would be great.
There may well be other ways to do what you want. Eg:
Grouping Objects
Attributed Blocks
Also, AutoCAD has a mechanism called Extended Entity Data which is included in any DXF data file (see the link provided).
AutoCAD provides some tools for working with XDATA and you can also use third-party extensions like CADPower and GeoTools that have an arsenal of XDATA tools. And ofcourse, you can write you own plugins to do what you what.
In summary, you could attach the handle of the TEXT as XDATA to the POLYLINE representing the room. Once you have attached the TEXT as XDATA it will be available in the DXF file and you will be able to parse it and locate the handle of the TEXT element.
It isn't too hard to write a VBA macro to run in AutoCAD that asks you to select the two elements and it then add the text entity handle as the XDATA. Then you are good to go.
I want to have the names of the polygons of kml file, displayed in google earth.
I converted the kml file from a shapefile in qgis. The kml file is loaded normally, i can see the name and the description in the list on the google earth panel. I cannot see it on the map though. How can I visualize the names?
I know that i can create a second kml file with points and have those displayed but I need to have one single file for all.
How could I do that?
Thank you
If you don't want to use a 2nd KML file for the centroid points + labels, then you can take your original KML file, wrap each polygon in a MultiGeometry tag, and add the polygon's centroid Point feature into each MuiltiGeometry. Then you can have the labels on those points, and have them be part of the same file as the polygons. Unfortunately I don't know of any easy way to create such a thing in QGIS, so you're probably left with hand-editing or programatically generating the KML.
I have a contour map that is provided to me by a private company. it comes in the form of a .dwg that works for autocad. In the past i have gotten contour data from usgs but the data provided to me is much more accurate. I want these contours in the .dwg to get loaded into arcmap so I can use them to delineate watersheds as per usual procedure.
Try to open .dwg file from ArcMap's add data option, locate the .dwg file, double click on it and it will show you it's sub-files, open Polyline file or any other file from it as u desire.
Then you can create its boundary and DEM to carry out your tasks.
I would like to know if there is any way to just take our relevant data from a pdf file. Suppose we have something like this Name:John, so we can some how automate to take just this field value in order to store it somewhere like a predefined database or file?? Thanks.
Use pdftotext to extract text content from your pdf file. Then parse the text file with your favorite programming language.
If your pdf doesn't contain real text, just images of text, you will need to use an optical character recognition software to extract the text.