Loading of ArcGis Engine vector layers and raster layers

Source: Internet
Author: User
Tags imap


Here is the vector layer loading method, because the layer itself is already produced by the Mxd class project file, so directly using the Mxd loading mode
If(Axmapcontrol1.checkmxfile (Shpfile))//determine if an mxd file{IArray pArry; PArry=axmapcontrol1.readmxmaps (Shpfile, Type.Missing); IMap PMap; for(inti =0; i < Parry.count; i++) {PMap= Parry.get_element (i) asIMap; if(Pmap.name = ="Layers") {Axmapcontrol1.mousepointer=Esricontrolsmousepointer.esripointerhourglass; Axmapcontrol1.loadmxfile (Shpfile,0, Type.Missing); Axmapcontrol1.mousepointer=Esricontrolsmousepointer.esripointerdefault; } }

///Here is how the raster layer is loaded, you need to open the Iworkspace
StringFilePath ="file path"; stringPathName =System.IO.Path.GetDirectoryName (FilePath); stringFileName =System.IO.Path.GetFileName (FilePath); Iworkspacefactory pwsf; Pwsf=NewRasterworkspacefactoryclass (); Iworkspace PWS; PWS= Pwsf.openfromfile (PathName,0); Irasterworkspace Prws; Prws= PWS asIrasterworkspace; Irasterdataset Prasterdataset; Prasterdataset=Prws.openrasterdataset (fileName); Irasterpyramid Praspyrmid; Praspyrmid= Prasterdataset asIrasterpyramid; if(Praspyrmid! =NULL) { if(!(praspyrmid.present)) {praspyrmid.create (); }} Iraster Praster; Praster=Prasterdataset.createdefaultraster (); Irasterlayer Prasterlayer; Prasterlayer=NewRasterlayerclass (); Prasterlayer.createfromraster (Praster); ILayer PLayer= Prasterlayer asILayer; Axmapcontrol1.addlayer (PLayer,2);//set the display hierarchy for a raster layer

Loading of ArcGis Engine vector layers and raster layers

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.