<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to load shapefile layer to current map? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-load-shapefile-layer-to-current-map/m-p/1108670#M7247</link>
    <description>&lt;P&gt;To add a data source to your current active map (or another map) you can use the snippet:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public Task&amp;lt;Layer&amp;gt; AddLayer(string uri)
{
    return QueuedTask.Run(() =&amp;gt;
    {
        Map map = MapView.Active.Map;
        return LayerFactory.Instance.CreateLayer(new Uri(uri), map);
    });
}&lt;/LI-CODE&gt;&lt;P&gt;and you would call the method like this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var pathToSource = @"c:\temp\test.shp";
Layer lyr = await AddLayer(pathToSource);&lt;/LI-CODE&gt;&lt;P&gt;and some examples for pathToSource&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;FeatureClass inside a FileGeodatabase: C:\Data\MyFileGDB.gdb\Census&lt;/LI&gt;&lt;LI&gt;A shape file inside a folder: \\Machine\SharedFolder\Census.shp&lt;/LI&gt;&lt;LI&gt;Raster Dataset inside a FileGeodatabase: C:\Data\MyFileGDB.gdb\DEM&lt;/LI&gt;&lt;LI&gt;An image file inside a folder: \\Machine\SharedFolder\Imagery.tif&lt;/LI&gt;&lt;LI&gt;A map service layer: &lt;A href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;A feature layer off a map or feature service: &lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;A .lprx or .lpkx file: \\Machine\SharedFolder\Fires.lyrx&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Tue, 19 Oct 2021 01:26:09 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2021-10-19T01:26:09Z</dc:date>
    <item>
      <title>How to load shapefile layer to current map?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-load-shapefile-layer-to-current-map/m-p/1108304#M7240</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;does anyone have any c # code that can load the shapefile into the current map and add the same reference so that it fits well into the original map?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank for any advice&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 05:20:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-load-shapefile-layer-to-current-map/m-p/1108304#M7240</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-10-18T05:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to load shapefile layer to current map?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-load-shapefile-layer-to-current-map/m-p/1108670#M7247</link>
      <description>&lt;P&gt;To add a data source to your current active map (or another map) you can use the snippet:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public Task&amp;lt;Layer&amp;gt; AddLayer(string uri)
{
    return QueuedTask.Run(() =&amp;gt;
    {
        Map map = MapView.Active.Map;
        return LayerFactory.Instance.CreateLayer(new Uri(uri), map);
    });
}&lt;/LI-CODE&gt;&lt;P&gt;and you would call the method like this:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var pathToSource = @"c:\temp\test.shp";
Layer lyr = await AddLayer(pathToSource);&lt;/LI-CODE&gt;&lt;P&gt;and some examples for pathToSource&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&amp;nbsp;FeatureClass inside a FileGeodatabase: C:\Data\MyFileGDB.gdb\Census&lt;/LI&gt;&lt;LI&gt;A shape file inside a folder: \\Machine\SharedFolder\Census.shp&lt;/LI&gt;&lt;LI&gt;Raster Dataset inside a FileGeodatabase: C:\Data\MyFileGDB.gdb\DEM&lt;/LI&gt;&lt;LI&gt;An image file inside a folder: \\Machine\SharedFolder\Imagery.tif&lt;/LI&gt;&lt;LI&gt;A map service layer: &lt;A href="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer" target="_blank"&gt;http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;A feature layer off a map or feature service: &lt;A href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/NapervilleShelters/FeatureServer/0&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;A .lprx or .lpkx file: \\Machine\SharedFolder\Fires.lyrx&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Tue, 19 Oct 2021 01:26:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-load-shapefile-layer-to-current-map/m-p/1108670#M7247</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-10-19T01:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to load shapefile layer to current map?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-load-shapefile-layer-to-current-map/m-p/1108699#M7249</link>
      <description>&lt;P&gt;Thank you!!!&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 04:12:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-load-shapefile-layer-to-current-map/m-p/1108699#M7249</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-10-19T04:12:31Z</dc:date>
    </item>
  </channel>
</rss>

