This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(tm) | |
a <- Corpus(DirSource("C:/Users/jgrimes/Desktop/text/"), readerControl = list(language="lat")) | |
#summary(a) | |
a <- tm_map(a, function(x) iconv(enc2utf8(x), sub = "byte")) | |
a <- tm_map(a, removePunctuation) | |
a <- tm_map(a, removeNumbers) | |
a <- tm_map(a, stripWhitespace) | |
a <- tm_map(a, tolower) | |
a <- tm_map(a, removeWords, stopwords("english")) | |
a <- tm_map(a, stemDocument, language = "english") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT latitude,longitude, (3963.191 * ACOS( | |
(SIN(PI()* 40.7383040 /180)*SIN(PI()*latitude/180)) + | |
(COS(PI()* 40.7383040 /180)*cos(PI()*latitude/180)*COS(PI() * longitude/180-PI()* -73.99319 /180)) | |
)) AS distance | |
FROM TABLE | |
WHERE 1=1 | |
AND 3963.191 * ACOS( (SIN(PI()* 40.7383040 /180)*SIN(PI() * latitude/180)) + | |
(COS(PI()* 40.7383040 /180)*cos(PI()*latitude/180)*COS(PI() * longitude/180-PI()* -73.99319 /180)) | |
) <= 1.5 | |
ORDER BY 3963.191 * ACOS( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#script that attempts to match compare lat,long points two csv files, match by distance | |
#justin grimes (@justgrimes) 04/16/12 | |
import math | |
import csv | |
import sys | |
import re | |
# takes two lat/long points and returns distance, modified code from -> http://www.johndcook.com/python_longitude_latitude.html | |
def distance_on_unit_sphere(lat1, long1, lat2, long2): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# publiclibraries.com scraper | |
import BeautifulSoup | |
import urllib2 | |
l = [("http://www.publiclibraries.com/alabama.htm","AL"), | |
("http://www.publiclibraries.com/alaska.htm","AK"), | |
("http://www.publiclibraries.com/arizona.htm","AZ"), | |
("http://www.publiclibraries.com/arkansas.htm","AR"), | |
("http://www.publiclibraries.com/california.htm","CA"), |
NewerOlder