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

Earthquakes near Oakland, CA

Sort by date | Sort by magnitude -- [Last updated on: April 25, 2017, 11:39:49]

Date Epicenter Magnitude
April 19, 2017, 11:10:58 Hollister, California 2.63
April 21, 2017, 17:46:58 Mount Hamilton, California 2.36
April 25, 2017, 3:10:23 Coalinga, California 2.3
April 24, 2017, 14:58:28 Birds Landing, California 2.17
April 23, 2017, 16:54:26 Chualar, California 2.15
April 23, 2017, 16:04:01 Chualar, California 1.96
April 19, 2017, 2:18:00 Yountville, California 1.85
April 20, 2017, 23:16:06 San Ardo, California 1.77
April 24, 2017, 15:28:51 Birds Landing, California 1.76
April 22, 2017, 15:01:26 Paicines, California 1.75
April 21, 2017, 12:00:58 Napa, California 1.65
April 23, 2017, 20:20:42 Elk Creek, California 1.6
April 18, 2017, 22:24:53 La Honda, California 1.59
April 20, 2017, 2:16:23 Redwood Valley, California 1.56
April 22, 2017, 16:48:16 San Lucas, California 1.55
April 20, 2017, 12:22:17 Laytonville, California 1.53
April 19, 2017, 20:44:36 Fremont, California 1.53
April 24, 2017, 20:01:21 Kelseyville, California 1.52
April 20, 2017, 2:25:13 Lucerne, California 1.49
April 19, 2017, 16:46:31 Middletown, California 1.47
April 20, 2017, 11:24:28 San Ardo, California 1.41
April 21, 2017, 7:52:13 Cloverdale, California 1.36
April 19, 2017, 11:17:18 San Jose, California 1.35
April 19, 2017, 10:38:03 Los Altos, California 1.32
April 20, 2017, 8:19:24 San Jose, California 1.25
April 23, 2017, 12:26:45 Chualar, California 1.24
April 21, 2017, 18:06:36 Gilroy, California 1.24
April 21, 2017, 0:34:27 Paicines, California 1.18
April 20, 2017, 13:33:38 Vallejo, California 1.15
April 23, 2017, 18:40:01 Parkfield, California 1.1
April 20, 2017, 13:57:14 Parkfield, California 1.1
April 18, 2017, 15:23:13 Sunol, California 1.1
April 24, 2017, 7:42:43 Geyserville, California 1.08
April 20, 2017, 9:00:13 Los Altos, California 1.08
April 22, 2017, 13:57:27 Hollister, California 1.07
April 22, 2017, 14:08:21 Napa, California 1.04
April 23, 2017, 15:27:26 Orinda, California 1.03
April 19, 2017, 23:34:50 Parkfield, California 1.01


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.