Known.Net | Family | Oakland, CA weather: overcast and 66.9 F | Earthquakes in last week: 60
 

Earthquakes near Oakland, CA

Sort by date | Sort by magnitude -- [Last updated on: September 23, 2014, 17:48:33]

Date Epicenter Magnitude
September 23, 2014, 11:51:14 Gilroy, California 1.27
September 23, 2014, 9:44:38 Napa, California 1.59
September 23, 2014, 8:32:59 Fremont, California 1.55
September 23, 2014, 3:30:17 Paskenta, California 1.43
September 22, 2014, 20:27:32 Hollister, California 1.49
September 22, 2014, 19:02:05 Paicines, California 1.2
September 22, 2014, 15:29:27 Hollister, California 1.3
September 22, 2014, 13:39:06 Napa, California 1.49
September 22, 2014, 12:11:43 Aromas, California 1.39
September 22, 2014, 12:07:41 Los Altos, California 1.58
September 22, 2014, 3:20:49 San Lucas, California 1.6
September 22, 2014, 2:14:04 Mare Island, California 1.2
September 21, 2014, 22:39:00 Sonoma, California 1.61
September 21, 2014, 22:36:13 Hollister, California 1.8
September 21, 2014, 21:45:20 Vallejo, California 1.57
September 21, 2014, 20:31:04 Sonoma, California 1.23
September 21, 2014, 12:17:53 Spanish Flat, California 2.63
September 21, 2014, 12:08:46 Napa, California 1.46
September 21, 2014, 11:19:26 Chualar, California 2.14
September 21, 2014, 11:19:00 Calistoga, California 1.36
September 21, 2014, 0:48:03 Palo Alto, California 1.15
September 21, 2014, 0:19:26 Westport, California 1.75
September 21, 2014, 0:12:16 San Juan Bautist, California 2.19
September 20, 2014, 20:33:45 Chualar, California 2.23
September 20, 2014, 18:18:44 San Lucas, California 1.86
September 20, 2014, 8:42:21 Livermore, California 1.44
September 20, 2014, 7:51:19 Paicines, California 2.32
September 20, 2014, 7:23:04 Napa, California 1.69
September 20, 2014, 4:33:15 Yountville, California 1.4
September 20, 2014, 0:30:11 Cromberg, California 1.4
September 19, 2014, 22:43:04 Suisun City, California 1.39
September 19, 2014, 19:00:13 San Lucas, California 1.66
September 19, 2014, 18:54:26 Napa, California 1.79
September 19, 2014, 17:03:57 Fremont, California 1.5
September 19, 2014, 15:34:20 Healdsburg, California 1.48
September 19, 2014, 12:23:16 Yountville, California 1.47
September 19, 2014, 11:02:26 Napa, California 1.62
September 19, 2014, 10:23:02 Mare Island, California 1.08
September 19, 2014, 6:37:56 Spanish Flat, California 1.24
September 19, 2014, 2:37:17 Livermore, California 2.49
September 19, 2014, 1:59:34 Livermore, California 1.94
September 18, 2014, 19:42:03 Napa, California 1.16
September 18, 2014, 17:37:25 Napa, California 1.84
September 18, 2014, 16:35:30 Hollister, California 2.26
September 18, 2014, 13:14:35 San Juan Bautist, California 1.45
September 18, 2014, 12:43:53 Prunedale, California 1.6
September 18, 2014, 11:46:20 Napa, California 1.31
September 18, 2014, 7:52:10 Hercules, California 1.45
September 17, 2014, 15:37:50 Chualar, California 1.1
September 17, 2014, 10:19:35 Los Altos, California 1.3
September 17, 2014, 8:48:09 Paicines, California 2.2
September 17, 2014, 5:40:59 Chualar, California 1.68
September 17, 2014, 5:29:51 San Lucas, California 1.47
September 17, 2014, 5:25:43 Hollister, California 1.05
September 17, 2014, 1:14:09 San Jose, California 1.59
September 17, 2014, 0:07:21 San Ardo, California 1.93
September 16, 2014, 21:35:26 Parkfield, California 1.1
September 16, 2014, 21:15:28 Paicines, California 1.2
September 16, 2014, 20:49:57 San Martin, California 2.3
September 16, 2014, 19:09:47 Big Sur, California 1.59

Filters

Place Magnitude
Cobb, California 3.0
California 2.0

Implementation notes

The earthquake info on this front page is periodically obtained via HTTP from http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/. It lists, for each earthquake, the time, magnitude, depth, latitude, longitude and other information. For presentation here, the location in decimal degrees (e.g., 39.099922,-120.02874, the middle of Lake Tahoe) is not that useful. So, there are two things that have to be done to the data: 1) convert the location coordinates into city names, and 2) filter out locations which are near where I live.

Converting location coordinates into city names is tricky. There is no readily available web resource that will do this (like Google Maps). I did find The Zip Code Database Project which contains location coordinates for each zip code, and the data includes the names of the cities for each zip code. It's a fairly simple matter to find the nearest match for a set of coordinates.

A side effect of trying to decide how to filter out remote locations from the data was that I needed to find the distances to nearby cities. That lead to the need to find the location of a city by name. Fortunately, Google Maps provides this information. Their API requires that you supply a key assigned to you, and obtaining that key is easy. Once you do, you can make dynamic calls to their service to implement something like this:

cl-user(7): (place-to-location "Oakland, CA")
#<location 37.804443,-122.26972>
cl-user(8): (place-to-location "Berkeley, CA")
#<location 37.871666,-122.27167>
cl-user(9): (location-to-place (place-to-location "Berkeley, CA"))
"Berkeley, California"
cl-user(10): (location-to-place
	      (place-to-location
	       "2600 College Ave, Berkeley, CA"))
"Berkeley, California"
cl-user(11): (place-to-location "2600 College Ave, Berkeley, CA")
#<location 37.86319,-122.25365>
cl-user(12): 

Lastly, it helped me get a feel for how to filter the data by implementing a function to find the distance between two locations. It uses the "Great Circle Distance Formula". Some examples (distances are in miles):

cl-user(16): (distance-between
	      (place-to-location "2600 College Ave, Berkeley, CA")
	      (place-to-location "Grand Ave, Oakland, CA"))
2.953326988975596d0
cl-user(17): (distance-between
	      (place-to-location "Boulder, CO")
	      (place-to-location "Oakland, CA"))
923.7414773838934d0
cl-user(18): (distance-between
	      (place-to-location "Lake Wylie, SC")
	      (place-to-location "Oakland, CA"))
2283.922367943316d0
cl-user(19): 
These are straight line distances, not the distances that Googles Maps would give for driving between these locations.

11 Oct 2007 Update: added a google map of quakes.

6 Mar 2008 Update: added a Simile Timeline of quakes.

The following code is used to generate the Javascript used to display the google map and Simile timeline. It uses ParenScript to generate Javascript from Lisp.

(defun quake-javascript-file (req ent)
  (declare (ignore req ent))
  (when *quakes-in-last-week*
    (html
;;;; Support for Google maps
     (:princ (ps* `(defvar home-name "Piedmont, CA")))
     (:princ (ps* `(defvar home-lat ,(location-latitude
				      *default-public-reference-location*))))
     (:princ (ps* `(defvar home-lon ,(location-longitude
				      *default-public-reference-location*))))
     (:princ (ps* `(defvar zoom 7)))
     (:princ (ps* `(defvar blue-icon-url ,*blue-icon-url*)))
     :newline
     (:princ
      (ps*
       `(defun add-places (map)
	  (let ((default-icon (new (*g-icon *G_DEFAULT_ICON*))))
	    ,@(let ((places '()))
		(dolist (place *quakes-in-last-week* places)
		  (let* ((location (third place))
			 (name (format nil "~a<br>magnitude ~a<br>~a"
				       (second place) ;; name
				       (fourth place) ;; magnitude
				       (excl::ut-to-date (first place))))
			 (lat (location-latitude location))
			 (lon (location-longitude location)))
		    (push `(add-place map ,lat ,lon ,name default-icon)
			  places))))))))
     :newline
     (:princ
      (ps
       (defun add-place (map lat lon label icon)
	 (let ((point (new (*g-lat-lng lat lon)))
	       (marker (new (*g-marker point (create :icon icon)))))
	   (*g-event.add-listener
	    marker
	    "click"
	    (lambda () (map.open-info-window-html point label)))
	   (map.add-overlay marker)))
       
       (defun initialize ()
	 (stripe "playlist" "#fff" "#edf3fe")
	 (stripe "playlist2" "#fff" "#edf3fe")
	 (when (*g-browser-is-compatible)
	   (let ((map (new (*g-map2 (document.get-element-by-id "map_canvas"))))
		 (blue-icon (new (*g-icon *G_DEFAULT_ICON*))))
	     (map.set-center (new (*g-lat-lng home-lat home-lon)) zoom)
	     (map.add-control (new (*g-small-map-control)))
	     (map.add-control (new (*g-map-type-control)))
	     (setf blue-icon.image blue-icon-url)
	     (add-place map home-lat home-lon home-name blue-icon)
	     (add-places map)))
	 (simile-timeline-init))))
     :newline

;;;; Support for Simile timeline - http://simile.mit.edu/timeline/
     (:princ (ps* `(defvar time-line)))
     (:princ (ps* `(defvar time-line-date
		       ,(let ((tl-start
			       (car (car (last *quakes-in-last-week*))))
			      (tl-end (car (car *quakes-in-last-week*))))
			  (simile-date
			   (truncate (/ (+ tl-start tl-end) 2)))))))
     :newline
     (:princ
      (ps
       (defun simile-timeline-init ()
	 (let ((event-source (new (*timeline.*default-event-source)))
	       (band-infos 
		(array
		 (*timeline.create-band-info
		  (create :event-source event-source
			  :date time-line-date
			  :width "80%"
			  :interval-unit *timeline.*date-time.*HOUR*
			  :interval-pixels 100))
		 (*timeline.create-band-info
		  (create :show-event-text nil
			  :track-height 0.5
			  :track-gap 0.2
			  :event-source event-source
			  :date time-line-date
			  :width "20%"
			  :interval-unit *timeline.*date-time.*WEEK*
			  :interval-pixels 300)))))
	   (setf (slot-value band-infos 1 'sync-with) 0)
	   (setf (slot-value band-infos 1 'highlight) t)
	   (.event-painter.set-layout
	    (aref band-infos 1)
	    (.event-painter.get-layout (aref band-infos 0)))
				      
	   (setf time-line
	     (*timeline.create (document.get-element-by-id "quake-timeline")
			       band-infos))
	   (*timeline.load-x-m-l "/quakedata.xml"
				 (lambda (xml url)
				   (event-source.load-x-m-l xml url)))))))
     :newline
     (:princ (ps* `(defvar resize-timer-i-d nil)))
     :newline
     (:princ
      (ps
       (defun on-resize ()
	 ;; Function called from body's `onresize'
	 (when (= resize-timer-i-d nil)
	   (setf resize-timer-i-d
	     (window.set-timeout (lambda ()
				   (setf resize-timer-i-d nil)
				   (time-line.layout))
				 500))))))
     :newline)))


Home

Last updated on: Saturday, September 17, 2011 16:11 GMT+8 by e40 (at) known [dot] net.