{"id":1945,"date":"2015-12-03T02:28:37","date_gmt":"2015-12-03T02:28:37","guid":{"rendered":"https:\/\/grindgis.com\/?p=1945"},"modified":"2015-12-03T03:25:37","modified_gmt":"2015-12-03T03:25:37","slug":"arcgis-plotting-multiple-values","status":"publish","type":"post","link":"https:\/\/grindgis.com\/?p=1945","title":{"rendered":"Arcgis plotting multiple values from two tables \u2013 one to many relationship \u2013 Solution to Join"},"content":{"rendered":"<p style=\"text-align: justify;\">It has been while I have not written any blog due to my tight schedule. I thought to start blogging again as my work load has decreased. This week at work I was facing some challenges in the ArcGIS to label field from attribute table and excel sheets. The challenges was same polygon have more than two values and have to plot all the multiple values. ArcGIS Join tool pull only the first value and rest is ignored. It is the case of one to many relationship. Join tool allows only one to one relationship. So there is a way to plot multiple values without writing a code. I have attached VB script to do that as well. To perform this task first you have to relate the table, then join the table, and finally label it.<\/p>\n<p style=\"text-align: justify;\"><img decoding=\"async\" class=\"alignleft\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott1.png\" alt=\"\" align=\"left\" \/><br \/>\n<strong><span style=\"font-size: 11pt;\">Note: This is only possible for files in same geodatabase, so create the geodatabase and import your shapefile and excel sheets in same geodatabase.\u00a0But if you want to label from shapefile and .dbf tables then you can use VB code that is shown below. Enjoy the tutorial!<\/span><\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott2.png\" alt=\"\" align=\"left\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Process: <span style=\"color: #00b050; font-size: 14pt;\">Relate &gt; Join &gt; Label<\/span><\/strong><\/p>\n<p style=\"text-align: justify;\">For this project I am creating feature class with four attributes A, B, C, and D. See below image for attribute values.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott3.png\" alt=\"\" \/><\/p>\n<p style=\"text-align: justify;\">Also, you have values from the excel sheet for attribute A, B, C, and D and you want to plot all the multiple values.<strong><br \/>\n<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott4.png\" alt=\"\" \/><strong><br \/>\n<\/strong><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-size: 50pt;\"><strong>1.<\/strong><\/span> First step you have to do is save the excel file. Note, lower version of ArcGIS might only accept older version of excel file, so you can save it on 2003 format. <span style=\"text-decoration: underline;\"><strong>Then import that excel sheets into the geodatabase where your feature class is sitting<\/strong><\/span>. Once your excel file is imported then first <span style=\"color: #00b050;\"><strong>Relate<\/strong><\/span> it.<\/p>\n<p style=\"margin-left: 18pt;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott5.png\" alt=\"Relate it\" width=\"358\" height=\"340\" \/><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-size: 50pt;\"><strong>2.<\/strong><\/span> Now you assign the field to relate, in our case is the <span style=\"color: #00b050;\"><strong>Name. <\/strong><span style=\"color: black;\">Then browse your imported excel file in the geodatabase and select it, then assign the relating field from the drop down menu. In our case is again <span style=\"color: #00b050;\"><strong>Name<\/strong><span style=\"color: black;\">. On the last option give the name of the relationship. After all the assignment, press Ok to relate the excel table.<br \/>\n<\/span><\/span><\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott7.png\" alt=\"relate option\" width=\"396\" height=\"450\" \/><span style=\"color: black;\"><br \/>\n<\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-size: 50pt;\"><strong>3.<\/strong><\/span><span style=\"color: black;\"> Now Relationship is done, next process is to join. Note: to verify your relationship you can use identify tool which will show both tables values. To join the table click on the <span style=\"color: #00b050;\"><strong>Join button<\/strong><span style=\"color: black;\">.<br \/>\n<\/span><\/span><\/span><\/p>\n<p style=\"text-align: justify;\"><span style=\"font-size: 50pt;\"><strong>4.<\/strong><\/span><span style=\"color: black;\"> On the join opened window, assign <span style=\"color: #00b050;\"><strong>Name<\/strong><span style=\"color: black;\"> as a joining field. Again, browse the saved excel sheets and select <span style=\"color: #00b050;\"><strong>Name <\/strong><span style=\"color: black;\">as join to field. Then press Ok button to join the table.<br \/>\n<\/span><\/span><\/span><\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott8.png\" alt=\"join tool\" width=\"396\" height=\"374\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott9.png\" alt=\"Join option\" width=\"396\" height=\"572\" \/><\/p>\n<p><span style=\"font-size: 50pt;\"><strong>5.<\/strong><\/span><span style=\"color: black;\"> Now the last process is to label, for that click on the layer properties and select the label tab. On the label field assign <span style=\"color: #00b050;\"><strong>values_1<\/strong><br \/>\n<span style=\"color: black;\">in our case.<br \/>\n<\/span><\/span><\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott10.png\" alt=\"label window\" width=\"585\" height=\"386\" \/><\/p>\n<p><span style=\"font-size: 50pt;\"><strong>6.<\/strong><\/span><span style=\"color: black;\"> On the map all the related values will be plotted. See the output image below.<br \/>\n<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott11.png\" alt=\"final output map\" width=\"358\" height=\"289\" \/><\/p>\n<h2><span style=\"color: #00b050; font-size: 20pt;\"><strong>How to do using the VB Script in ArcGIS.<\/strong><\/span><\/h2>\n<p>&nbsp;<\/p>\n<p>Open the Arcgis <span style=\"color: #00b050;\"><strong>properties<\/strong><\/span>, then click the <span style=\"color: #00b050;\"><strong>label<\/strong><\/span> tab and then click on the <span style=\"color: #00b050;\">Expression<\/span> button.<\/p>\n<p><span style=\"font-size: 50pt;\"><strong>1.<\/strong><\/span> Check the <span style=\"color: #00b050;\"><strong>Advanced\u00a0<\/strong><\/span>tab and make sure you have selected <span style=\"color: #00b050;\"><strong>Vbscript<\/strong><br \/>\n<\/span>as a parser.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/grindgis.com\/wp-content\/uploads\/2015\/12\/120315_0228_Arcgisplott12.png\" alt=\"label expression window\" width=\"358\" height=\"444\" \/><\/p>\n<p><span style=\"font-size: 50pt;\"><strong>2.<\/strong><\/span> Delete the existing code and paste the below code. But read below steps to assign your values.<\/p>\n<div style=\"margin-left: 18pt;\">\n<table style=\"border-collapse: collapse; background: #d9d9d9;\" border=\"0\">\n<colgroup>\n<col style=\"width: 597px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr>\n<td style=\"padding-left: 7px; padding-right: 7px; border: solid #00b050 2.25pt;\">\n<p style=\"margin-left: 18pt;\"><em>Function FindLabel ( [<strong>feature class field name<\/strong>] )<br \/>\nSet gp = CreateObject(&#8220;esriGeoprocessing.GPDispatch.1&#8221;)<br \/>\nstrWhereClause = chr(34) &amp; &#8220;<strong>Related table field name<\/strong>&#8221; &amp; chr (34) &amp; &#8221; = &#8216;&#8221; &amp; [<strong>feature class field name<\/strong>] &amp; &#8220;&#8216;&#8221;<br \/>\nstrpTable =\u00a0<strong>&#8220;Path to the table&#8221;<\/strong><br \/>\nSet prows = gp.searchcursor(strpTable,strWhereClause)<br \/>\nSet prow = prows.next<br \/>\nDo until prow is nothing<br \/>\nstrLabel = prow.<strong>LabelField<\/strong><br \/>\nFindLabel = FindLabel &amp; strLabel &amp; vbnewline<br \/>\nSet prow = prows.next<br \/>\nLoop<br \/>\nEnd Function\u00a0<\/em><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"text-align: justify;\"><strong><em>Note: if you add your tables into the ArcGIS you do not have to assign the path, just type the name of the table but it should contains geodatabase name in the front ( you will find your table name in the source tab if you open layer properties), code source is from <a href=\"https:\/\/gisnuts.com\">https:\/\/gisnuts.com<\/a><br \/>\n<\/em><\/strong><\/p>\n<p style=\"text-align: justify;\">Let us say, you have feature class called parcel and you want to join through field name called parcel id. Also, you have table called tablejoin to merge with parcel layer through parcelid1. Replace the value in above code as below then:<\/p>\n<div>\n<table style=\"border-collapse: collapse; height: 199px;\" border=\"0\" width=\"589\">\n<colgroup>\n<col style=\"width: 128px;\" \/>\n<col style=\"width: 256px;\" \/><\/colgroup>\n<tbody valign=\"top\">\n<tr style=\"height: 18px;\">\n<td style=\"padding-left: 7px; padding-right: 7px; border: solid 1.0pt;\"><strong><em>feature class field name:<\/em><\/strong><\/td>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: solid 1.0pt; border-left: none; border-bottom: solid 1.0pt; border-right: solid 1.0pt;\"><span style=\"color: black;\">parcel id.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 1.0pt; border-bottom: solid 1.0pt; border-right: solid 1.0pt;\"><span style=\"color: #00b050;\"><strong><em>Related table field name:<\/em><\/strong><\/span><\/td>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 1.0pt; border-right: solid 1.0pt;\"><span style=\"color: black;\">parcelid1<\/span><\/td>\n<\/tr>\n<tr style=\"height: 20px;\">\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 1.0pt; border-bottom: solid 1.0pt; border-right: solid 1.0pt;\"><span style=\"color: #00b050;\"><strong><em>Path to the table:<\/em><\/strong><\/span><\/td>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 1.0pt; border-right: solid 1.0pt;\"><span style=\"color: black;\"><em>C:\/gis\/tablejoin <\/em><\/span><\/td>\n<\/tr>\n<tr style=\"height: 18px;\">\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 1.0pt; border-bottom: solid 1.0pt; border-right: solid 1.0pt;\"><span style=\"color: #00b050;\"><strong><em>LabelField:<\/em><\/strong><\/span><\/td>\n<td style=\"padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 1.0pt; border-right: solid 1.0pt;\"><span style=\"color: black;\"><em>Field you want to label it.<\/em><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p style=\"text-align: justify;\">\n","protected":false},"excerpt":{"rendered":"<p>It has been while I have not written any blog due to my tight schedule. I thought to start blogging again as my work load has decreased. This week at work I was facing some challenges in the ArcGIS to label field from attribute table and excel sheets. The challenges was same polygon have more [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1948,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[31,368,372,371,369,370],"class_list":["post-1945","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arcgis","tag-arcgis","tag-join","tag-multiple-values","tag-one-to-many-relationship","tag-relate","tag-vbcode","entry","has-media"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/posts\/1945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1945"}],"version-history":[{"count":0,"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/posts\/1945\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=\/wp\/v2\/media\/1948"}],"wp:attachment":[{"href":"https:\/\/grindgis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/grindgis.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}