How to grab info from DC Metro site to create XML file?

I feel like this may be a trivial problem for most people but I'm new at doing all this, so any help would be much appreciated!

So I need to get the coordinates of all the DC metro stops from the website. I did some searching and what I figured out is that the site with all the stations provides you with the option to click on the name of the station, which then shows a map of where the station is located. When you click on the map, you are directed to a google maps page where the coordinates are shown in the search box. I also noticed that the URL contains the coordinates as well.

From the research I did, it looks like it's possible to parse through the source code of the original DC metro website that holds all of the stations, go through each link to the stations, and then parse through the source code of each station's individual website to grab the coordinates and the name of the station. Once that is retrieved, it can be stored into an XML file. I wanted to make the XML look something like:

<stations>
   <station>
      <name>Ballston-MU</name>
      <lat>38.882071</lat>
      <long>-77.111845</long>
   </station>
   <station>
      <name>Addison Road</name>
      <lat>38.886713</lat>
      <long>-76.893592</long>
   ...
</stations>

I don't really have an preference to what language to use. I'm not even sure which one would be easier. I've used javascript and jquery to do the rest of the project. But since I only need the XML file, I don't think it'll matter what langauge I use to create it.

Sorry I know this is super long!!!

Answers


Just in case anyone was wondering, I did what user thg435 said and used the DC metro's own API. Just registered, got an API key, and used the URL they gave to get the XML file with all the info needed! :)

This was the URL (gotta insert your own custom API key to make it work): http://api.wmata.com/StationPrediction.svc/GetPrediction/A10?api_key=YOUR_API_KEY


Need Your Help

Execute JavaScript on partial render

javascript ruby-on-rails ruby

I have some JavaScript code that I'd like to execute after a user clicks one of their folders -- it triggers the show action and show.js.erb, which renders the partial.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.