{"id":98,"date":"2019-05-28T07:13:51","date_gmt":"2019-05-28T07:13:51","guid":{"rendered":"https:\/\/embers.nicejacket.cc\/blog\/?p=98"},"modified":"2019-05-28T14:23:42","modified_gmt":"2019-05-28T14:23:42","slug":"measuring-area-in-illustrator-to-scale","status":"publish","type":"post","link":"https:\/\/embers.nicejacket.cc\/blog\/2019\/05\/28\/measuring-area-in-illustrator-to-scale\/","title":{"rendered":"Measuring Area in Illustrator to Scale"},"content":{"rendered":"\n<p>I&#8217;m building out a full wiki for <a href=\"http:\/\/embers.nicejacket.cc\/known-eilarun.html\">The Embers<\/a>, and one element in the Infobox I&#8217;ve been leaving blank is Area (square miles). Counting hexes and estimating seems laborious and ineffective, but there wasn&#8217;t a good way to measure the exact area of nations, baronies, tribal reaches, and free cities of Eilar\u00fbn.<\/p>\n\n\n\n<!--more-->\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"297\" height=\"496\" src=\"https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-1.png\" alt=\"\" class=\"wp-image-100\" srcset=\"https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-1.png 297w, https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-1-180x300.png 180w\" sizes=\"auto, (max-width: 297px) 85vw, 297px\" \/><figcaption>Fewer red links each day, but those xxx,xxx haunted my dreams.<\/figcaption><\/figure><\/div>\n\n\n\n<p>This might not be helpful to those who map in Photoshop, GIMP, etc., though Inkscape does have a feature similar to Illustrator&#8217;s Image Trace, so one could always export a large bitmap from whichever program and get SVG shapes that way.<\/p>\n\n\n\n<p><strong>Scroll to the bottom if you just want the code.<\/strong><\/p>\n\n\n\n<p>I knew that my hexes were 24 miles from center to center, or 12 miles from center to apothem, but I didn&#8217;t know the side length, which is, I think, the easiest way to calculate hexagon area:<\/p>\n\n\n\n<p style=\"text-align:center\"><em>A = (3 \u00d7 \u221a3 \u00d7 s\u00b2) \/ 2<\/em><\/p>\n\n\n\n<p>In Illustrator, Window &gt; Document Info &gt; Objects will give you the length of a path. So that solved side length, and I could calculate area. A side was 0.1419 inches. My hexes were 0.052314 inches square.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"532\" height=\"534\" src=\"https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-3.png\" alt=\"\" class=\"wp-image-102\" srcset=\"https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-3.png 532w, https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-3-150x150.png 150w, https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-3-300x300.png 300w\" sizes=\"auto, (max-width: 532px) 85vw, 532px\" \/><\/figure>\n\n\n\n<p>Now to figure out the ratio and get a scale factor.<\/p>\n\n\n\n<p>I always try to check my math &#8211; a <a href=\"https:\/\/www.dragonsfoot.org\/forums\/viewtopic.php?p=865774&amp;sid=47eba5622e1a0842ac9b1b0e27634ae0#p865774\">post<\/a> on a 1e d&amp;d forum (so you know they&#8217;re serious) gave me the area of a hexagon at certain dimensions.<\/p>\n\n\n\n<p>I created a line that was 24 inches at 90\u00b0 in Illustrator, Alt+Shift created a hexagon centered on the lower endpoint, and then Alt+Shift expanded the bounding box until the upper edge reached the midpoint.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"661\" height=\"466\" src=\"https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-4.png\" alt=\"\" class=\"wp-image-103\" srcset=\"https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-4.png 661w, https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-4-300x211.png 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>My math from the side above matches the forum&#8217;s number. I now have my ratio (scale factor):<\/p>\n\n\n\n<p style=\"text-align:center\"><em>R = (hex area in miles) \/ (hex area in inches on map)<\/em><\/p>\n\n\n\n<p>I found <a href=\"https:\/\/gist.github.com\/bryanbuchanan\/11387501\">this code snippet<\/a> on Github, which allows one to get the area of a shape in Illustrator, in in\u00b2 and cm\u00b2. Using the scale factor, I can calculate the area in mi\u00b2 (because what self-respecting grimdark would use a logical system like metric?).<\/p>\n\n\n\n<p style=\"text-align:center\"><em>(shape area in miles) = R \u00d7 (shape area in inches)<\/em><\/p>\n\n\n\n<p>I&#8217;m already using a script; why not fork and modify for this specific use?<\/p>\n\n\n\n<p>Adds\/changes to <a href=\"https:\/\/gist.github.com\/bryanbuchanan\">bryanbuchanan<\/a>&#8216;s code:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>I stripped out centimeters (that was a mistake; it would give more granularity &#8211; important when working at small scales &#8211; I will likely add back in)<\/li><li>Increased decimalPlaces to 10 (see: small scales)<\/li><li>Added the scale factor math above<\/li><li>Multiplied scale factor by areaIn<\/li><li>alert() box changes, including rounding off and a prettyprint with commas for mi\u00b2 from <a href=\"https:\/\/stackoverflow.com\/a\/2901298\">here<\/a><\/li><\/ul>\n\n\n\n<p>You&#8217;ll need to adjust hexAreaInchesMap to the area of your map&#8217;s hexes. If you&#8217;re not using 24 mile hexes, you&#8217;ll also need to adjust hexAreaMileActual to the area your hexes represent.<\/p>\n\n\n\n<p>If you&#8217;d like to fork, or follow as I update\/expand on this (revert to cm, fix that km\u00b2  isn&#8217;t really as exact as it should be, convert this to python for Inkscape, etc.), you can <a href=\"https:\/\/gist.github.com\/heynicejacket\/bc329428c6198613f90e481a9e568439\">find my code on Github here<\/a>.<\/p>\n\n\n\n<p>Save as a .jsx file. In Illustrator, select the border outline of a nation, then run the script from File &gt; Scripts.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"905\" height=\"726\" src=\"https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-5.png\" alt=\"\" class=\"wp-image-104\" srcset=\"https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-5.png 905w, https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-5-300x241.png 300w, https:\/\/embers.nicejacket.cc\/blog\/wp-content\/uploads\/2019\/05\/image-5-768x616.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption>Worldbuilding detail obsession made simple(r)!<\/figcaption><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m building out a full wiki for The Embers, and one element in the Infobox I&#8217;ve been leaving blank is Area (square miles). Counting hexes and estimating seems laborious and ineffective, but there wasn&#8217;t a good way to measure the exact area of nations, baronies, tribal reaches, and free cities of Eilar\u00fbn.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-98","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/posts\/98","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/comments?post=98"}],"version-history":[{"count":10,"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/posts\/98\/revisions"}],"predecessor-version":[{"id":120,"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/posts\/98\/revisions\/120"}],"wp:attachment":[{"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/media?parent=98"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/categories?post=98"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embers.nicejacket.cc\/blog\/wp-json\/wp\/v2\/tags?post=98"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}