Click here to Skip to main content
15,115,261 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have added one layer on another layer using map control (eg on world_adm0.shp i have added india_ds.shp). Now I want to save this map as a shapefile.
My code is saving it but not opening it as it showing invalid file fomat.
For creating a shapefile three file formats is needed (.shp , .shx , .dbf) but i am unable to create it.
Posted
Updated 4-Apr-10 2:37am
v3

What do you mean by map control ? There's no map control in .NET.
   
Don't repost the same question a second time.
   
If you are using MapWinGis Control to open file then

sh.SaveAs(filename,null)

where
sh is Object of Shape class
filename is you want to give i.e. .shp
   
First, I think you need to find a book (or several) on GIS. If I am understanding you properly, you have added two shapefiles to a map. Now you want to save them as one, correct?

Do you understand what is supposed to go into each of the three files?

This is not the same as saving the map file (mxd if you are using ArcGIS) as a shapefile. You have to union the two layers, and you have to decide how you want to do that. Do you want to simply overlay them, or do you want to do a full union where the boundaries from one polygon or polyline split the boundaries of another to create new polygons or polylines.

Then, you would have to create a new shapefile, and transfer each individual feature to the new shapefile. Of course, most mapping programs will do all of this automatically by running a simple command. For instance, with ArcGIS, to run the join, you can use "Union_analysis <in_features {Ranks};in_features {Ranks}...> <out_feature_class> {NO_FID | ONLY_FID | ALL} {cluster_tolerance} {GAPS | NO_GAPS}"

But again, you haven't provided us enough information, and you would me better off finding a forum specific to the program you are using. If you are using ArcGIS, there are plenty of forums on the ESRI Developer's Network that you can search through and post new questions.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900