We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I'm currently working on a school project where I need to visualize different areas of a city in Processing. I have a KML-file that I've converted to XML, that contains coordinates of different green areas that I want to insert in my visualisation, but I'm not really sure how to import the data. I've inserted the XML-file into a XML Viewer to get an overview, and the data that I want to import is in the folder for all of the 57 green areas, all named "outerBondaryIs" ( https://www.dropbox.com/s/ysx0fr3anjrgy2z/XML Overview.png ).
So far, I've tried to use the example from the processing-homepage ( http://www.processing.org/reference/XML.html ), but I can't figure out how to use my own XML-file.
Here's the XML-file that I want to use: https://www.dropbox.com/s/4gb45pitft259dl/parker.xml
My teacher wants us to use classes in our code so the xmlreader has to be in a class as well. By the way, I'm very new to Processing so I'm seeking a simple solution ( or a thorough explaination on how to do it).
I hope that someone wants to help!
Thanks in advance,
M
Answers
maybe a lib can help
search gpx
https://forum.processing.org/reference/libraries/
Thank you for your reply. I would like to keep it in XML - and if it is possible I would like to do it without using a library. Any other suggestions? M
here....
since you want to collect area data I propose a class area
since we don't know how many you have I also propose a ArrayList of that class
you would have to do the tutorial on OOP
also read the reference on ArrayList please
the idea is to loop over all Placemarks in the xml put each with the name into a object (type Area) and put this into the ArrayList
To Do
you have to finish the class (constr and draw)
you have to make the object correct in the loop
there might be flaws with the parsing of the xml
also I didn't have a clue as to how get the geo-coors on the screen so I just killed the first 3 letters ;-)
you really have to do some house cleaning there
I am not proud on this...
continued here:
http://forum.processing.org/two/discussion/4750/npe-when-loading-an-xml-into-processing