New shape file--Create a Featureclass store as a shape file

Source: Internet
Author: User

1 /// <summary>Create a point shapefile2 /// </summary>3 /// <param name= "FilePath" >Target Point Shapefile path</param>4 /// <param name= "FileName" >Target Point shapefile name</param>5  Public Static voidCreatepointshapefile (IMap map,stringFilePath,stringfileName)6 {7   //Create a shape field8Ifields Pfields =NewFieldsclass ();9Ifieldsedit Pfieldsedit = Pfields asIfieldsedit;TenIfield Pfield =NewFieldclass (); OneIfieldedit Pfieldedit = Pfield asIfieldedit; Apfieldedit.name_2 ="Shape"; -pfieldedit.type_2 =Esrifieldtype.esrifieldtypegeometry; -  the  //setting Geometry definition -Igeometrydef Pgeometrydef =NewGeometrydefclass (); -Igeometrydefedit Pgeometrydefedit = Pgeometrydef asIgeometrydefedit; -pgeometrydefedit.geometrytype_2 = Esrigeometrytype.esrigeometrypoint;//point, line, Polygon +pgeometrydefedit.spatialreference_2 =map. spatialreference; -Pfieldedit.geometrydef_2 =Pgeometrydef; +Pfieldsedit.addfield (Pfield); A  at  //new Field -Pfield =NewFieldclass (); -Pfieldedit = Pfield asIfieldedit; -pfieldedit.length_2 =Ten; -pfieldedit.name_2 ="ID"; -pfieldedit.aliasname_2 ="ID"; inpfieldedit.type_2 =Esrifieldtype.esrifieldtypesmallinteger; -Pfieldsedit.addfield (Pfield); to  //continue to add additional fields +  -Iworkspacefactory pworkspacefactory =Newshapefileworkspacefactory (); theIfeatureworkspace pfeatureworkspace = Pworkspacefactory.openfromfile (FilePath,0) asIfeatureworkspace; *  $  //iworkspacefactory pworkspacefactory = new Filegdbworkspacefactoryclass ();Panax Notoginseng  //ifeatureworkspace pfeatureworkspace = pworkspacefactory.openfromfile (FilePath, 0) as Ifeatureworkspace; -  the  inti = Filename.indexof (". SHP"); +  if(i = =-1) APfeatureworkspace.createfeatureclass (FileName +". SHP", Pfields,NULL,NULL, Esrifeaturetype.esriftsimple,"Shape",""); the  Else +Pfeatureworkspace.createfeatureclass (FileName, Pfields,NULL,NULL, Esrifeaturetype.esriftsimple,"Shape",""); -  $ //MessageBox.Show ("OK"); $  -}

New shape file--Create a Featureclass store as a shape file

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.