增强功能

Provide a solution using Silverlight API for ArcGIS to upload shapefiles from their computer to Silverlight Map directly

上次发布: August 25, 2014 ArcGIS API for Silverlight
增强功能 ID 编号 NIM079697
已提交August 22, 2014
上次修改时间June 5, 2024
适用范围ArcGIS API for Silverlight
找到的版本2.4
编程语言xaml
状态Will Not Be Addressed

附加信息

Will not be part of ArcGIS SL API, however they can upload to a server that generates features the ArcGIS SL API can understand.

备用工作流程

private void openFileDialog_Click( object sender, RoutedEventArgs e )
{
//Create the dialog allowing the user to select the "*.shp" and the "*.dbf" files
OpenFileDialog ofd = new OpenFileDialog();
ofd.Multiselect = true;

if( !( ofd.ShowDialog() ?? false ) )
return;

//Get the file info objects for the SHP and the DBF file selected by the user
FileInfo shapeFile = null;
FileInfo dbfFile = null;
foreach( FileInfo fi in ofd.Files )
{
if( fi.Extension.ToLower() == ".shp" )
{
shapeFile = fi;
}
if( fi.Extension.ToLower() == ".dbf" )
{
dbfFile = fi;
}
}

//Read the SHP and DBF files into the ShapeFileReader
ShapeFile shapeFileReader = new ShapeFile();
if( shapeFile != null && dbfFile != null )
{
shapeFileReader.Read( shapeFile, dbfFile );
}
else
{
HtmlPage.Window.Alert( "Please select a SP and a DBF file to proceed." );
return;
}

//Add the shapes from the shapefile into a graphics layer named "shapefileGraphicsLayer"
//the greaphics layer should be present in the XAML or created earlier
GraphicsLayer graphicsLayer = MyMap.Layers[ "shapefileGraphicsLayer" ] as GraphicsLayer;
foreach( ShapeFileRecord record in shapeFileReader.Records )
{
Graphic graphic = record.ToGraphic();
if( graphic != null )
graphicsLayer.Graphics.Add( graphic );
}
}

重现步骤

当漏洞状态发生变化时获得通知

下载 Esri 支持应用程序

发现关于本主题的更多内容

联系技术支持部门

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项