Skip to content

Instantly share code, notes, and snippets.

@scitasy
scitasy / XMLSubwayEdgeExtractor.java
Last active December 17, 2015 03:29
Reading an XML file in Java, innit.
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@scitasy
scitasy / HTMLtoGeoJSON.java
Last active December 16, 2015 17:09
Code that scrapes data from an HTML page using Selenium and stores it as a GeoJSON object. Which, by the way, is just a JSON object it turns out. With a particular format. Just FYI. Y'know. Cuz I didn't.
public class HTMLtoGeoJSON
{
public static void main(String[] args)
{
//Create the Selenium WebDriver object
WebDriver driver = new FirefoxDriver();
//Navigate to the subway locations page
driver.get("http://wiki.openstreetmap.org/wiki/List_of_London_Underground_stations");
@scitasy
scitasy / HTMLtoJSON.java
Created April 26, 2013 15:29
A class that uses Selenium to scrape data from a webpage and store it in a JSON file. IS PRETTY NIFTY YA'LL.
public class HTMLtoJSON
{
public static void main(String[] args)
{
//I need to know the range of long and lat for a project I'm working on
//so I declare variables that I will use later to store the info
double xMin = -100;
double xMax = -100;
double yMin = -100;
double yMax = -100;
@scitasy
scitasy / main.java
Last active December 16, 2015 13:39
Using Selenium to SCRAPE DAT WEB.
public class Main
{
public static void main(String[] args)
{
//Create the Selenium WebDriver object
WebDriver driver = new FirefoxDriver();
//Navigate to the subway locations page
driver.get("http://wiki.openstreetmap.org/wiki/List_of_London_Underground_stations");