dana
YaBB Newbies
Offline
Posts: 2
Parsing SVG map / polygons
Nov 3rd , 2008, 5:32pm
Hello, I'm trying to create a sketch to adjust the fills of neighborhoods (polygons) on a map as they correlate with county election data. The map and the web site of the election dept display the same neighborhoods, and importing and parsing the data is going to be relatively simple --- it's getting the SVG to load correctly where I'm having trouble. I'm able to load a bordering rectangle but have no luck displaying any of the polygons (map elements). Are there any tips for SVG formatting in processing? I have a sneaking suspicion that my problem may be the particulars of my SVG, as I had to generate it from GIS and other data formats which I am not too familiar with. You can see the SVG here, http://thecoocoup.com/neighborhoods.svg A sample program, it will even acknowledge child elements, but not render them on the screen! PShape s; s = loadShape("neighborhoods.svg"); // load neighborhoods size(int(s.getWidth()),int(s.getHeight())); // set width/height to svg values smooth(); s.disableStyle(); stroke(255,0,0); shape(s, 0, 0, width/2, height/2); // draw shape PShape t = s.getChild("4"); // look up the child t.disableStyle(); stroke(255,0,0); println(t); // it's not null shape(t, 0,0,width/2, height/2); Thank you for any help, it is much appreciated! ============ UPDATE: after trying several methods of converting my data to SVG, and much fuss in Illustrator I was able to get things working well enough. It's not perfect but it's good enough for election night :)