![]() In the original, for example, each of the elements is just one long line.Īs you can see, each of the layers is inside a element, and the id attribute is the layer’s name. I’ve redacted most of the data associated with the bitmapped drawing, and I’ve added hard line breaks to make it easier to read. What comes out is a very large text file that looks like this: xml: What I need to do next is export it as an SVG file, which, conveniently, Graphic can do on both the Mac and iPad. So now I have a document in Graphic’s native format, which doesn’t do me much good. I could have used Bezier curves for those portions, but straight lines work better with the Shapely library, which is what I’m going to use to calculate the area (in the next blog post this one is going to concentrate on processing the SVG, which I’m about to get to). If you do, you’ll notice that the curved areas of the cutouts are approximated by a series of straight lines. I’ve made this graphic higher in resolution than I normally do for images here so you can zoom in to see the structure if you like. The drawing layer is for the bitmap, the outline layer is for the outer boundary in blue the cutouts layer is for the open areas of the Rotunda, the House and Senate chambers, the old Senate chambers, and Statuary Hall outlined in red and the scale layer is for the green box drawn over the 64-foot scale just below the title. You can see the layers to the right of the image. Here’s what it looks like in Graphic on the iPad. Then I make layers above the bitmap and draw in the outer boundary, the holes or cutouts in the floor, and some length or feature that I can use to scale the drawing. I start by importing the file into a vector graphics program like Graphic, OmniGraffle, or Affinity Designer. Let’s say I want to get the area of this floor. The drawings usually come to me as bitmapped images 1 like this one of the US Capitol, which I downloaded from Wikipedia. Most of my work has started with me tracing over the areas of interest in plan view drawings so I can calculate distances and areas. But I’ve gradually learned how to use Python’s XML modules to automate the processing, which has both sped up my work and increased its accuracy. Initially, the processing was mostly manual, via cutting, pasting, finding, and replacing in BBEdit. Over the past few months, I’ve been creating and processing a lot of SVG files. Next post Previous post Processing layered SVGs
0 Comments
Leave a Reply. |