Blog
Precocious Pixels
What have I done to myself? While the Skyline idea was a great concept, executing it is a bit of a pain, with all those irregular shapes. I spend most of the day figuring out the best way to go about it. Obviously there will be a database involved, to store all the polygon coordinates, but first I need to map it out in Excel. Once I have all the coords in a spreadsheet, I can make text formulas to generate the SQL statements to get them in the database. Yeah sure, easier said than done.
I also need to know how many pixels are in each parcel. Since the coords are now in a spreadsheet, it makes sense to try to use that data to calculate the areas. I google “area of a polygon”, and find the equation I’m looking for here
:

I set that up in my spreadsheet, and get results that are WAY off. Oh, duh, I need to close the polygon for the equation to work. Since the <area> tag does not need the closing coordinate, I hadn’t included that in my data. Well, after making this fix, the results are at least plausible, but a quick manual check reveals they are not quite right. After some thought, I conclude that since pixels do have an actual thickness (they are not mathematical “points” of zero size), and some lines between coords are not perfectly straight, the equation will not work as-is. I briefly considered trying to come up with a fudge factor, but the work involved, especially the checking to see if it is right, would be more than just counting the little suckers by hand.
So, I blow the image up 1600% in my graphics editor, and start counting the largest possible rectangular shapes within each parcel, while keeping track of the leftover pixels along the periphery. Halfway through, I realize that actually painting the rectangles a contrasting color goes faster than moving the ruler origin and keeping track of the rectangles in my head.
By the end of the day, I had a complete survey of all my Skyline parcels. Whew, what a start!
No Comments yet »
RSS feed for comments on this post.
Trackback URI for this post:
http://austinmash.com/blog/precocious-pixels/trackback/





