{"id":235,"date":"2009-07-16T22:19:48","date_gmt":"2009-07-17T03:19:48","guid":{"rendered":"http:\/\/www.cartogrammar.com\/blog\/?p=235"},"modified":"2009-08-19T08:39:29","modified_gmt":"2009-08-19T13:39:29","slug":"simple-shapefile-drawing-in-actionscript-3","status":"publish","type":"post","link":"https:\/\/andywoodruff.com\/blog\/simple-shapefile-drawing-in-actionscript-3\/","title":{"rendered":"Simple shapefile drawing in ActionScript 3"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/www.cartogrammar.com\/images\/shpToMap.jpg\" alt=\"Shapefile + magic = map in Flash!\" \/><\/p>\n<p>Recently I&#8217;ve heard two friends independently inquire about some sort of basic guide for loading and drawing a shapefile in Flash. The only real tutorial\/example I can recall is <a href=\"http:\/\/www.boxshapedworld.com\/blog\/post\/Shapefiles-Actionscript-30-and-Google-Maps.aspx\">here<\/a>, dealing with Google Maps.  But these guys are looking for something more bare-bones.  Being a regular user of <a href=\"http:\/\/vanrijkom.org\/wordpress\/\">Edwin van Rijkom<\/a>&#8216;s invaluable <a href=\"http:\/\/code.google.com\/p\/vanrijkom-flashlibs\">code libraries<\/a> for reading shapefiles, and usually forgetting the process myself, I thought it would be a good idea to put together a very simple set of AS3 classes that load a shapefile and throw a map on screen. <\/p>\n<p>So to get those jerks off my back, I wrote a little thing called ShpMap, which supplements van Rijkom&#8217;s classes by loading and drawing a shapefile. It&#8217;s nothing fancier than that. Sometimes all you need is to get your base map on screen.  (<em><strong>Update<\/strong>: just to round it out a little more, I&#8217;ve added basic loading and parsing of a shapefile&#8217;s accompanying DBF file, which contains attribute data. This also uses classes by van Rijkom.<\/em>)<\/p>\n<p>I hope that this class (and the several associated classes) can both be directly usable for some projects and serve as a basic guide to using van Rijkom&#8217;s classes to load shapefiles.<\/p>\n<p>Dig it:<\/p>\n<ul>\n<li>An <a href=\"http:\/\/www.cartogrammar.com\/flash\/shp\/ShapefileExample.html\">example<\/a> that loads and displays a US states shapefile (and then puts a square on my house and colors the state of Wisconsin green). View the source code <a href=\"http:\/\/www.cartogrammar.com\/flash\/shp\/srcview\/index.html\">here<\/a>.<\/li>\n<li>Download the <a href=\"http:\/\/www.cartogrammar.com\/flash\/shp\/srcview\/ShapefileExample.zip\">source code<\/a>. (My classes plus van Rijkom&#8217;s, as well as a demo US States shapefile.) <\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Recently I&#8217;ve heard two friends independently inquire about some sort of basic guide for loading and drawing a shapefile in Flash. The only real tutorial\/example I can recall is here, dealing with Google Maps. But these guys are looking for something more bare-bones. Being a regular user of Edwin van Rijkom&#8216;s invaluable code libraries for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[14,46],"class_list":["post-235","post","type-post","status-publish","format-standard","hentry","category-code","tag-as3","tag-shapefiles"],"_links":{"self":[{"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/posts\/235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/comments?post=235"}],"version-history":[{"count":17,"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/posts\/235\/revisions"}],"predecessor-version":[{"id":315,"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/posts\/235\/revisions\/315"}],"wp:attachment":[{"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/media?parent=235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/categories?post=235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andywoodruff.com\/blog\/wp-json\/wp\/v2\/tags?post=235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}