Known.Net | Family | Oakland, CA weather: partly cloudy and 61.0 F | Earthquakes in last week: 38

Earthquakes near Oakland, CA

Sort by date | Sort by magnitude -- [Last updated on: April 17, 2014, 18:10:25]

Date Epicenter Magnitude
April 15, 2014, 5:43:10 Paicines, California 2.9
April 11, 2014, 11:43:23 Chualar, California 2.8
April 11, 2014, 3:18:54 California 2.4
April 16, 2014, 21:43:17 San Lucas, California 2
April 12, 2014, 1:39:25 California 2
April 17, 2014, 15:25:39 Paicines, California 1.9
April 17, 2014, 8:30:51 Paicines, California 1.9
April 17, 2014, 2:07:50 Ladera, California 1.9
April 16, 2014, 10:44:31 Paskenta, California 1.9
April 17, 2014, 13:12:49 Paicines, California 1.8
April 16, 2014, 20:52:37 Coalinga, California 1.8
April 12, 2014, 8:04:51 Potter Valley, California 1.72
April 16, 2014, 20:48:28 San Lucas, California 1.7
April 13, 2014, 17:08:06 Paicines, California 1.7
April 13, 2014, 10:44:47 San Jose, California 1.7
April 12, 2014, 18:59:29 Potter Valley, California 1.7
April 17, 2014, 6:52:10 Cloverdale, California 1.6
April 16, 2014, 20:57:05 Cantua Creek, California 1.6
April 15, 2014, 0:44:10 Healdsburg, California 1.6
April 14, 2014, 1:14:42 Kelseyville, California 1.6
April 13, 2014, 16:33:31 La Honda, California 1.6
April 11, 2014, 9:13:13 Butte City, California 1.6
April 17, 2014, 2:38:48 Ladera, California 1.5
April 13, 2014, 16:33:31 La Honda, California 1.5
April 12, 2014, 3:30:32 Windsor, California 1.5
April 11, 2014, 21:29:14 Paicines, California 1.5
April 11, 2014, 10:21:38 Los Altos, California 1.5
April 17, 2014, 8:39:41 Ladera, California 1.4
April 15, 2014, 16:57:34 Paskenta, California 1.4
April 15, 2014, 8:03:00 Paicines, California 1.4
April 13, 2014, 17:10:36 Paicines, California 1.3
April 12, 2014, 19:04:32 Paicines, California 1.3
April 16, 2014, 6:58:12 San Lucas, California 1.2
April 14, 2014, 20:24:42 Chualar, California 1.2
April 11, 2014, 10:17:33 Soda Springs, California 1.14
April 11, 2014, 23:50:07 Alamo, California 1.1
April 11, 2014, 15:49:29 Parkfield, California 1.1
April 15, 2014, 3:15:24 Oakland, California 1.04


Place Magnitude
Cobb, California 3.0
California 2.0

Implementation notes

The earthquake info on this front page is periodically obtained via HTTP from 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
	       "2600 College Ave, Berkeley, CA"))
"Berkeley, California"
cl-user(11): (place-to-location "2600 College Ave, Berkeley, CA")
#<location 37.86319,-122.25365>

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"))
cl-user(17): (distance-between
	      (place-to-location "Boulder, CO")
	      (place-to-location "Oakland, CA"))
cl-user(18): (distance-between
	      (place-to-location "Lake Wylie, SC")
	      (place-to-location "Oakland, CA"))
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*
;;;; Support for Google maps
     (:princ (ps* `(defvar home-name "Piedmont, CA")))
     (:princ (ps* `(defvar home-lat ,(location-latitude
     (:princ (ps* `(defvar home-lon ,(location-longitude
     (:princ (ps* `(defvar zoom 7)))
     (:princ (ps* `(defvar blue-icon-url ,*blue-icon-url*)))
       `(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)
       (defun add-place (map lat lon label icon)
	 (let ((point (new (*g-lat-lng lat lon)))
	       (marker (new (*g-marker point (create :icon icon)))))
	    (lambda () ( 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)))

;;;; Support for Simile 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*))))
			   (truncate (/ (+ tl-start tl-end) 2)))))))
       (defun simile-timeline-init ()
	 (let ((event-source (new (*timeline.*default-event-source)))
		  (create :event-source event-source
			  :date time-line-date
			  :width "80%"
			  :interval-unit *timeline.*date-time.*HOUR*
			  :interval-pixels 100))
		  (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)
	    (aref band-infos 1)
	    (.event-painter.get-layout (aref band-infos 0)))
	   (setf time-line
	     (*timeline.create (document.get-element-by-id "quake-timeline")
	   (*timeline.load-x-m-l "/quakedata.xml"
				 (lambda (xml url)
				   (event-source.load-x-m-l xml url)))))))
     (:princ (ps* `(defvar resize-timer-i-d nil)))
       (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)


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