AutoCAD Map 3D Forum
Welcome to Autodesk’s AutoCAD Map 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export single entities as shp files 2013

10 REPLIES 10
Reply
Message 1 of 11
davpla69
921 Views, 10 Replies

Export single entities as shp files 2013

I need to export many polygons into separate shp files for import into another program. Can anyone give some pointers?

 

Thanks!

 

Dave

Tags (1)
10 REPLIES 10
Message 2 of 11
antoniovinci
in reply to: davpla69

Do you mean you have N polygons, and you wanna export N shapefiles..?

What for, sir?

You'd better _MAPEXPORT all to a single shapefile, then automatically split in N parts, e.g. thru Qgis.

Message 3 of 11
davpla69
in reply to: antoniovinci

Yes, that's correct. We have another program that imports the shp files into a database, and cannot import more than one at a time. At the most, we'd have approximately 100 separate shp files. I don't want to run mapexport 100 times, then import 100 times.

 

Thanks-

Message 4 of 11
Alfred.NESWADBA
in reply to: davpla69

Hi,

 

>> We have another program that imports the shp files into a database, [...]

>> [...] I don't want to run mapexport 100 times, then import 100 times

If you want to get 100 SHP-files you will have to start the import then 100 times ...

What mystic software can only use SHP-files with just one polygon in it?

What database-server (and structure) do you fill with that software, maybe we find a way to fill all polygons in one step.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 5 of 11
antoniovinci
in reply to: davpla69

Like Alfred, I cannot believe your software does accept only one polygon at once.

 

Instead I guess it will process ONE SHAPEFILE at once, containing N polygons.

 

Anyway, you can export everything to a SINGLE shape, then split it in 100 sub-shapes by means of the free Qgis.

 

You should also _MAPEXPORT the Ehandle OD attribute, to allow Qgis catching the 100 unique values, and automatically create the 100 small shapes.

Message 6 of 11
davpla69
in reply to: Alfred.NESWADBA

We use an agricultural software package called Real-Time Ag that tracks the nutrient requirements of zones in fields. It will not import files that contain more than one shape. Also, when we import more than one shp file at a time, it connects the poly's together, making it impossible to edit the individual zones in each field, not to mention the separate fields. Each zone in each field has its own nutrient requirements and soil qualities. I'm looking for a way to import these fields and zones more efficiently. Right now the mapping portion of the project is the weak link.

 

Thanks-

Message 7 of 11
Murph_Map
in reply to: davpla69

You could try it with lisp, set a counter as the export name then for each entity in a selection set mapexport name from the counter. How well do you know lisp programing or willing to pay someone for it? 

Murph
Supporting the troops daily.
Message 8 of 11
hence_the_name
in reply to: davpla69

Hi Dave,

 

you can do that with Map. When exporting to SHP you can create multiple SHP files in one go.

 

1) _mapexport - choose "SHP Multiclass" as filetype and the select a folder for export

2) in second tab ("Feature class" or similar - I do not have the english version and translate from german) choose the second option

3) the drop down list becomes availabe - there you can choose based on which property the polygons are going to be separated

 

I suppose you cannot use "Layer" - or is each polygon on a separate layer?

You can use MapImport to put each polygon on a separate layer:

 

- export all polygons to SHP file (single SHP file) - select export option to add ID column (AdMapKey)

- import the shape file - in import dialog you can choose an attribute to separate features - choose AdMapKey

--> each polygon will end up on a separate layer

 

-  do export as described above.

 

By the way - I tried to separate the features based on object data (ID field) but it didn't work. That only leaves the way described above.

 

Good luck,

Rob

 

Screenshots attached:

pic1.png

 

pic2.png

 

 

pic3.png

 

pic4.png

 

 

http://raumpatrouille3d.blogspot.ch/
Message 9 of 11

here is a simple lisp routine to export one a time

 

(defun c:SingleShape ( / i ss path name)
 (setq ss (ssget)i 0 path "c:\\temp\\")
 (while (setq ent(ssname  ss i))
  (if (findfile(setq name(strcat path (cdr(assoc 5(entget ent)))".shp")))
   (command "mapexport" "shp" name "O" "N" "S" "Polygon""M" (ssadd ent) "" "*"  "*"  "N"  "O"  "N"  "Y"  "P")
   (command "mapexport" "shp" name "N" "S" "Polygon""M" (ssadd ent) "" "*"  "*"  "N"  "O"  "N"  "Y"  "P")
  )
  (setq i (1+ i))
 )
)

 

 

Below are the options for MAPEXPORT in the command line

  "mapexport"  ;; command
  "shp"            ;; export type 
  name            ;;export file name
  "O"               ;; if exists -> overwrite
  "N"               ;; Profile
  "S"               ;; Select option
  "Polygon"     ;; Type of shape
  "M"              ;; Manual selection
  (ssadd ent)    ;; selction set
  ""                 ;; confirm selection set
  "*"                ;; Layer filter
  "*"                ;;Class filter
  "N"               ;;Topology
  "O"               ;;Options
  "N"               ;;Coord conversion
  "Y"               ;;Polylines as polygones
  "P"               ;;Proceed

 

 

 

Message 10 of 11

Dont forget to set FILEDIA to 0 before you do it 

Message 11 of 11


MetroVancouverDrafting wrote:

Dont forget to set FILEDIA to 0 before you do it 


 

Moreover, sounds like you should store all your shapefiles in the C:\TEMP folder, isn't it?

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost