Skip to content

Commit

Permalink
hmm....
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy Arnold committed Jul 2, 2010
1 parent 635b745 commit 870619e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions GMaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ function initialize() {
} else {
$N = 25;
}
for ($i = 0; $i < ($N-1); $i++) {
for ($j = 0; $j < ($N-1); $j++) {
for ($i = 0; $i < $N); $i++) {
for ($j = 0; $j < $N); $j++) {
$freqArr[$i][$j] = 0;
$lowerLat[$i] = $minLat + $i*($maxLat-$minLat)/$N;
$upperLat[$i] = $minLat + ($i+1)*($maxLat-$minLat)/$N;
Expand All @@ -88,12 +88,12 @@ function initialize() {
}

$maxFreq = 0;
for ($i = 0; $i < ($N-1); $i++) {
for ($i = 0; $i < $N; $i++) {
$maxFreq = max($maxFreq, max($freqArr[$i]));
}

for ($i = 0; $i < ($N-1); $i++) {
for ($j = 0; $j < ($N-1); $j++) {
for ($i = 0; $i < $N; $i++) {
for ($j = 0; $j < $N; $j++) {
$intensity = $freqArr[$i][$j] / $maxFreq;
if ($intensity <= 0.33) {
$colorDecimal = (int)(255 * $intensity / 0.33);
Expand Down
5 changes: 4 additions & 1 deletion populateSQL.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

system("rm show30")
system("wget http://maps.azstarnet.com/crime/show30 > /dev/null")
system("./extract show30 > tmp")
system("/home/tjarnold/public_html/GMaps/extract show30 > tmp")

lat = []
lng = []
Expand Down Expand Up @@ -54,6 +54,7 @@
db="GoogleHeatMap")
c = db.cursor()

rowsAdded = 0
for i in range(len(lat)):
c.execute ("""
SELECT UniqueID FROM TucsonCrime WHERE UniqueID=%s""", (str(UID[i])))
Expand All @@ -64,6 +65,8 @@
(Latitude, Longitude, EventDate, UniqueID, CrimeType)
VALUES (%s, %s, %s, %s, %s)""",\
(str(lat[i]), str(lng[i]), date[i], str(UID[i]), crime[i]))
rowsAdded += 1

c.close ()
db.close ()
print "%4.0f rows added" % (rowsAdded)

0 comments on commit 870619e

Please sign in to comment.