{"id":162111,"date":"2009-03-05T21:18:39","date_gmt":"2009-03-05T21:18:39","guid":{"rendered":"http:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=162111"},"modified":"2018-12-18T11:32:49","modified_gmt":"2018-12-18T19:32:49","slug":"tips-and-tricks-accessing-feature-shape-in-calculate-field","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field","title":{"rendered":"Tips and tricks \u2013 accessing feature shape in Calculate Field"},"author":3991,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[23341],"tags":[24321,24341,33131],"industry":[],"product":[36991],"class_list":["post-162111","blog","type-blog","status-publish","format-standard","hentry","category-analytics","tag-geoprocessing","tag-python","tag-tips-and-tricks","product-arcgis-desktop"],"acf":{"short_description":"With the\u00a0Calculate Field\u00a0tool, you can easily create expressions that use some property of a feature\u2019s shape, such as length or area.","flexible_content":[{"acf_fc_layout":"content","content":"<p>With the\u00a0<a href=\"http:\/\/resources.arcgis.com\/en\/help\/main\/10.1\/index.html#\/Calculate_Field\/00170000004m000000\/\" target=\"_blank\" rel=\"noopener\">Calculate Field<\/a>\u00a0tool, you can easily create expressions that use some property of a feature\u2019s shape, such as length or area. You can also convert length and area to different units. The illustration below shows calculating the MILES field to the length (in miles) of each line feature.<br \/>\n<span id=\"more-1162\"><\/span><br \/>\n<a href=\"http:\/\/downloads2.esri.com\/blogs\/images\/dev_3998.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"http:\/\/downloads2.esri.com\/blogs\/images\/dev_3998.jpg\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<h2>Details about the Expression syntax<\/h2>\n<p>The expression syntax:<br \/>\n!shape.length@miles!<br \/>\nstarts and ends with the special \u2018decode field\u2019 character. This decode field character is different depending on the value of the\u00a0<strong>Expression Type<\/strong>\u00a0parameter.\u00a0 For\u00a0<strong>Expression Type<\/strong>\u00a0of\u00a0PYTHON\u00a0or\u00a0PYTHON_9.3, the character is an exclamation point (\u201c!\u201d),\u00a0 as shown in the illustration above. For VB, the decode field characters are \u201c[&#8221; and &#8220;]\u201c.<\/p>\n<p>Inside the decode field characters, you can put the name of any field found on the input table. You can also use the reserved field name \u201cshape\u201d followed by a period and an attribute of the shape. I n this case, we\u2019re using the length attribute:\u00a0!shape.length!<\/p>\n<p>Finally, we convert\u00a0shape.length\u00a0to miles with the use of the special unit conversion syntax \u2018@&lt;unit&gt;\u2018.\u00a0 &lt;unit&gt; can be any of the following:<\/p>\n<p>CENTIMETERS | DECIMALDEGREES | DECIMETERS | FEET | INCHES | KILOMETERS | METERS | MILES | MILLIMETERS | NAUTICALMILES | POINTS | YARDS<\/p>\n<p>If your shape type is polygon, you can use these areal unit keywords:<\/p>\n<p>ACRES | ARES | HECTARES | SQUARECENTIMETERS | SQUAREDECIMETERS | SQUAREINCHES | SQUAREFEET | SQUAREKILOMETERS | SQUAREMETERS | SQUAREMILES | SQUAREMILLIMETERS | SQUAREYARDS<\/p>\n<h2>More things you can do with the shape object and its attributes<\/h2>\n<p>The shape field is actually a\u00a0<a href=\"http:\/\/resources.arcgis.com\/en\/help\/main\/10.1\/index.html#\/Geometry\/018z00000070000000\/\" target=\"_blank\" rel=\"noopener\">geometry object<\/a>\u00a0with the following properties.<\/p>\n<p><a href=\"http:\/\/downloads2.esri.com\/blogs\/images\/dev_3999.jpg\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" src=\"http:\/\/downloads2.esri.com\/blogs\/images\/dev_3999.jpg\" alt=\"\" border=\"0\" \/><\/a><\/p>\n<p>If, for example, you wanted the X-coordinate of the first point of a line, you would use\u00a0!shape.firstpoint.x!<br \/>\nTo find the minimum X-coordinate of the line, use\u00a0!shape.extent.xmin!<\/p>\n<h2>Simple equations<\/h2>\n<p>The expression can contain simple equations. For example, to calculate<br \/>\nminutes it would take to traverse a street segment going 30 miles per hour,<br \/>\nuse:<\/p>\n<p>!shape.length@miles! \/ (30.0 \/ 60.0)<\/p>\n<p>Note that:<\/p>\n<p>!shape.length@miles! \/ (30 \/ 60)<\/p>\n<p>won\u2019t work \u2013 when doing real arithmetic you need the decimal point after 30 and 60.<\/p>\n<h2>Code blocks<\/h2>\n<p>See\u00a0<a href=\"http:\/\/www.esri.com\/news\/arcuser\/0507\/files\/pythonscript.pdf\" target=\"_blank\" rel=\"noopener\">http:\/\/www.esri.com\/news\/arcuser\/0507\/files\/pythonscript.pdf<\/a>\u00a0for information on using code blocks in Calculate Field<\/p>\n"}],"authors":[{"ID":3991,"user_firstname":"Dale","user_lastname":"Honeycutt","nickname":"dmhoneycutt","user_nicename":"dmhoneycutt","display_name":"Dale Honeycutt","user_email":"dhoneycutt@esri.com","user_url":"","user_registered":"2018-03-02 00:15:37","user_description":"","user_avatar":"<img alt='' src='https:\/\/secure.gravatar.com\/avatar\/5431fd1559b9dcbc86438ecb083710d6710a1a74625018e6378d57ab2d6149fe?s=96&#038;d=blank&#038;r=g' srcset='https:\/\/secure.gravatar.com\/avatar\/5431fd1559b9dcbc86438ecb083710d6710a1a74625018e6378d57ab2d6149fe?s=192&#038;d=blank&#038;r=g 2x' class='avatar avatar-96 photo' height='96' width='96' loading='lazy' decoding='async'\/>"}],"related_articles":"","card_image":false,"wide_image":false},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Tips and tricks \u2013 accessing feature shape in Calculate Field<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tips and tricks \u2013 accessing feature shape in Calculate Field\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2018-12-18T19:32:49+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field\"},\"author\":{\"name\":\"Dale Honeycutt\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/ecf725596ec627cacb0bf10409502088\"},\"headline\":\"Tips and tricks \u2013 accessing feature shape in Calculate Field\",\"datePublished\":\"2009-03-05T21:18:39+00:00\",\"dateModified\":\"2018-12-18T19:32:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field\"},\"wordCount\":9,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"geoprocessing\",\"python\",\"tips and tricks\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field\",\"name\":\"Tips and tricks \u2013 accessing feature shape in Calculate Field\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2009-03-05T21:18:39+00:00\",\"dateModified\":\"2018-12-18T19:32:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tips and tricks \u2013 accessing feature shape in Calculate Field\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/ecf725596ec627cacb0bf10409502088\",\"name\":\"Dale Honeycutt\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5431fd1559b9dcbc86438ecb083710d6710a1a74625018e6378d57ab2d6149fe?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5431fd1559b9dcbc86438ecb083710d6710a1a74625018e6378d57ab2d6149fe?s=96&d=blank&r=g\",\"caption\":\"Dale Honeycutt\"},\"url\":\"\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Tips and tricks \u2013 accessing feature shape in Calculate Field","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field","og_locale":"en_US","og_type":"article","og_title":"Tips and tricks \u2013 accessing feature shape in Calculate Field","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2018-12-18T19:32:49+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field"},"author":{"name":"Dale Honeycutt","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/ecf725596ec627cacb0bf10409502088"},"headline":"Tips and tricks \u2013 accessing feature shape in Calculate Field","datePublished":"2009-03-05T21:18:39+00:00","dateModified":"2018-12-18T19:32:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field"},"wordCount":9,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["geoprocessing","python","tips and tricks"],"articleSection":["Analytics"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field","name":"Tips and tricks \u2013 accessing feature shape in Calculate Field","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2009-03-05T21:18:39+00:00","dateModified":"2018-12-18T19:32:49+00:00","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/arcgis-desktop\/analytics\/tips-and-tricks-accessing-feature-shape-in-calculate-field#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"Tips and tricks \u2013 accessing feature shape in Calculate Field"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/ecf725596ec627cacb0bf10409502088","name":"Dale Honeycutt","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5431fd1559b9dcbc86438ecb083710d6710a1a74625018e6378d57ab2d6149fe?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5431fd1559b9dcbc86438ecb083710d6710a1a74625018e6378d57ab2d6149fe?s=96&d=blank&r=g","caption":"Dale Honeycutt"},"url":""}]}},"text_date":"March 5, 2009","author_name":"Dale Honeycutt","author_page":false,"custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2025\/08\/Newsroom-Keyart-Wide-1920-x-1080.jpg","primary_product":"ArcMap","tag_data":[{"term_id":24321,"name":"geoprocessing","slug":"geoprocessing","term_group":0,"term_taxonomy_id":24321,"taxonomy":"post_tag","description":"","parent":0,"count":129,"filter":"raw"},{"term_id":24341,"name":"python","slug":"python","term_group":0,"term_taxonomy_id":24341,"taxonomy":"post_tag","description":"","parent":0,"count":171,"filter":"raw"},{"term_id":33131,"name":"tips and tricks","slug":"tips-and-tricks","term_group":0,"term_taxonomy_id":33131,"taxonomy":"post_tag","description":"","parent":0,"count":26,"filter":"raw"}],"category_data":[{"term_id":23341,"name":"Analytics","slug":"analytics","term_group":0,"term_taxonomy_id":23341,"taxonomy":"category","description":"","parent":0,"count":1325,"filter":"raw"}],"product_data":[{"term_id":36991,"name":"ArcMap","slug":"arcgis-desktop","term_group":0,"term_taxonomy_id":36991,"taxonomy":"product","description":"","parent":36981,"count":325,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=arcgis-desktop","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/162111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/3991"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=162111"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/162111\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=162111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=162111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=162111"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=162111"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=162111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}