<?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 Add a column to a layer object (inner join) then map amended layer   in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-a-column-to-a-layer-object-inner-join-then-map/m-p/850560#M3814</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm new to ArcGIS for Python&amp;nbsp;and I've been trying to figure this out for 2 weeks.&amp;nbsp;I am doing this in a ESRI python 3 jupyter notebook. editing feature layer‌&amp;nbsp;spatial dataframe&amp;nbsp;&lt;A href="https://community.esri.com/t5/tag/jupyter notebook/tg-p"&gt;#jupyter notebook&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;import pandas as pd&lt;BR /&gt;import arcgis&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt;my_gis = GIS()&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;#get feature layer&lt;/STRONG&gt;&lt;BR /&gt;search_subset = my_gis.content.search("SA2_GEN_ID_2011", item_type = "Feature Layer")&lt;BR /&gt;subset_item = search_subset[0]&lt;BR /&gt;subset_feature_layer = subset_item.layers[0]&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;#query and create spatialdataframe&lt;/STRONG&gt; &lt;BR /&gt;query_result = subset_feature_layer.query( where='SA2_MAIN&amp;gt;300000000 AND SA2_MAIN&amp;lt;400000000')&lt;BR /&gt;att_data_frame = query_result.df&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;#merge with suburb risk data (output is now a regular dataframe)&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;suburb_risk_data = pd.read_csv("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fs3-ap-southeast-2.amazonaws.com%2Finterestrates%2Fstress_example_1.csv" rel="nofollow" target="_blank"&gt;https://s3-ap-southeast-2.amazonaws.com/interestrates/stress_example_1.csv&lt;/A&gt;&lt;SPAN&gt;")&lt;/SPAN&gt;&lt;BR /&gt;suburb_risk_data['SA2_MAIN'] = suburb_risk_data['SA2_MAIN'].astype(str)&lt;BR /&gt;output = pd.merge(suburb_risk_data, att_data_frame, on='SA2_MAIN', how='inner')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i run into difficulty, I don't know how to convert the output dataframe into an object&amp;nbsp; that I can map using the .add_layer() method. The output dataframe has a 'SHAPE' column with the geographical information required for mapping (I think).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;#map the merged data (this fails because output is a dataframe)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;subset_map = my_gis.map("Queensland, Australia", zoomlevel=6)&lt;BR /&gt;subset_map.add_layer(&lt;SPAN style="color: #ff0000;"&gt;output&lt;/SPAN&gt;, { "renderer":"ClassedColorRenderer", "field_name":"stress_likelihood" })&lt;BR /&gt;subset_map&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need&amp;nbsp;to edit the layer here because I run a fairly complex python script above this to calculate the variables that I merge with the feature layer. I need to show how the variables change geographically based on the inputs the user provides.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help much appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 12 May 2018 00:19:08 GMT</pubDate>
    <dc:creator>GagneetSerai</dc:creator>
    <dc:date>2018-05-12T00:19:08Z</dc:date>
    <item>
      <title>Add a column to a layer object (inner join) then map amended layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-a-column-to-a-layer-object-inner-join-then-map/m-p/850560#M3814</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm new to ArcGIS for Python&amp;nbsp;and I've been trying to figure this out for 2 weeks.&amp;nbsp;I am doing this in a ESRI python 3 jupyter notebook. editing feature layer‌&amp;nbsp;spatial dataframe&amp;nbsp;&lt;A href="https://community.esri.com/t5/tag/jupyter notebook/tg-p"&gt;#jupyter notebook&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;import pandas as pd&lt;BR /&gt;import arcgis&lt;BR /&gt;from arcgis.gis import GIS&lt;BR /&gt;my_gis = GIS()&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;#get feature layer&lt;/STRONG&gt;&lt;BR /&gt;search_subset = my_gis.content.search("SA2_GEN_ID_2011", item_type = "Feature Layer")&lt;BR /&gt;subset_item = search_subset[0]&lt;BR /&gt;subset_feature_layer = subset_item.layers[0]&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;#query and create spatialdataframe&lt;/STRONG&gt; &lt;BR /&gt;query_result = subset_feature_layer.query( where='SA2_MAIN&amp;gt;300000000 AND SA2_MAIN&amp;lt;400000000')&lt;BR /&gt;att_data_frame = query_result.df&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;#merge with suburb risk data (output is now a regular dataframe)&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;suburb_risk_data = pd.read_csv("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fs3-ap-southeast-2.amazonaws.com%2Finterestrates%2Fstress_example_1.csv" rel="nofollow" target="_blank"&gt;https://s3-ap-southeast-2.amazonaws.com/interestrates/stress_example_1.csv&lt;/A&gt;&lt;SPAN&gt;")&lt;/SPAN&gt;&lt;BR /&gt;suburb_risk_data['SA2_MAIN'] = suburb_risk_data['SA2_MAIN'].astype(str)&lt;BR /&gt;output = pd.merge(suburb_risk_data, att_data_frame, on='SA2_MAIN', how='inner')&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now i run into difficulty, I don't know how to convert the output dataframe into an object&amp;nbsp; that I can map using the .add_layer() method. The output dataframe has a 'SHAPE' column with the geographical information required for mapping (I think).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;STRONG&gt;#map the merged data (this fails because output is a dataframe)&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;subset_map = my_gis.map("Queensland, Australia", zoomlevel=6)&lt;BR /&gt;subset_map.add_layer(&lt;SPAN style="color: #ff0000;"&gt;output&lt;/SPAN&gt;, { "renderer":"ClassedColorRenderer", "field_name":"stress_likelihood" })&lt;BR /&gt;subset_map&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need&amp;nbsp;to edit the layer here because I run a fairly complex python script above this to calculate the variables that I merge with the feature layer. I need to show how the variables change geographically based on the inputs the user provides.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help much appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 May 2018 00:19:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-a-column-to-a-layer-object-inner-join-then-map/m-p/850560#M3814</guid>
      <dc:creator>GagneetSerai</dc:creator>
      <dc:date>2018-05-12T00:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: Add a column to a layer object (inner join) then map amended layer</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/add-a-column-to-a-layer-object-inner-join-then-map/m-p/850561#M3815</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does&amp;nbsp;converting the &lt;SPAN style="font-family: 'andale mono', monospace;"&gt;SpatialDataFrame&lt;/SPAN&gt; to a &lt;SPAN style="font-family: 'andale mono', monospace;"&gt;FeatureSet&lt;/SPAN&gt;&amp;nbsp;work?&lt;/P&gt;&lt;PRE class="language-python line-numbers"&gt;&lt;CODE&gt;subset_map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;add_layer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;output&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;to_featureset&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"renderer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"ClassedColorRenderer"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"field_name"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"stress_likelihood"&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Jun 2018 23:26:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/add-a-column-to-a-layer-object-inner-join-then-map/m-p/850561#M3815</guid>
      <dc:creator>J_R_Matchett</dc:creator>
      <dc:date>2018-06-09T23:26:14Z</dc:date>
    </item>
  </channel>
</rss>

