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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.