Map the United States

For our next project, we’ll work with a US map saved as an SVG file, and we’ll load it as a file asset into our sketch. The SVG file contains a blank map showing all US states and borders and is available on Wikipedia in the public domain.[287] The XML code in the SVG file contains vertex style definitions to determine how to connect those vertex points, including stroke, thickness, and fill color.

We’ll implement this project in two steps. First we load the map using loadShape, and then we’ll draw it on the Android screen with Processing’s shape method. Second, we’ll alter the fill color of states that political poll takers typically consider as swing states during recent presidential elections and draw them as purple ...

Get Rapid Android Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.