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

Earthquakes near Oakland, CA

Sort by date | Sort by magnitude -- [Last updated on: July 3, 2015, 22:24:35]

Date Epicenter Magnitude
June 28, 2015, 19:16:08 Laytonville, California 2.71
July 3, 2015, 3:02:50 Paicines, California 2.41
July 2, 2015, 22:25:52 Glenn, California 2.19
July 1, 2015, 0:53:04 Hollister, California 2.11
June 28, 2015, 11:48:27 Parkfield, California 2.11
July 2, 2015, 17:42:05 Paicines, California 1.97
July 2, 2015, 9:33:39 Pulga, California 1.97
July 2, 2015, 21:42:20 Geyserville, California 1.96
July 2, 2015, 4:39:04 Chualar, California 1.94
June 28, 2015, 20:37:00 Coalinga, California 1.87
June 27, 2015, 12:17:00 San Lucas, California 1.86
June 29, 2015, 14:15:08 Paicines, California 1.84
June 27, 2015, 13:43:35 San Juan Bautist, California 1.83
July 3, 2015, 21:38:46 Lockwood, California 1.79
July 3, 2015, 21:38:46 Lockwood, California 1.79
June 28, 2015, 23:55:46 Paicines, California 1.77
June 26, 2015, 23:42:42 San Ramon, California 1.76
June 28, 2015, 8:08:06 Paicines, California 1.75
June 28, 2015, 20:40:23 Saint Helena, California 1.72
July 1, 2015, 0:21:55 Freedom, California 1.71
June 29, 2015, 7:06:27 Paicines, California 1.71
June 29, 2015, 16:04:56 Paicines, California 1.69
June 29, 2015, 2:26:58 Paicines, California 1.67
July 1, 2015, 10:51:13 Los Altos, California 1.61
June 30, 2015, 3:08:23 Clearlake Oaks, California 1.54
June 30, 2015, 2:32:13 Clearlake Oaks, California 1.52
June 28, 2015, 8:37:15 Paicines, California 1.52
June 30, 2015, 8:51:45 Hopland, California 1.48
July 3, 2015, 0:48:16 Morgan Hill, California 1.46
June 29, 2015, 3:19:59 Boonville, California 1.46
July 2, 2015, 6:16:35 Paicines, California 1.43
June 27, 2015, 17:57:45 Concord, California 1.43
June 27, 2015, 12:47:28 San Lucas, California 1.43
July 3, 2015, 0:03:00 Paicines, California 1.42
July 1, 2015, 23:17:39 Pope Valley, California 1.41
June 29, 2015, 18:04:23 Paicines, California 1.41
July 1, 2015, 21:48:49 Parkfield, California 1.38
July 2, 2015, 6:07:57 Morgan Hill, California 1.37
July 1, 2015, 9:22:33 Hollister, California 1.37
June 30, 2015, 3:54:58 Los Banos, California 1.36
June 28, 2015, 10:11:17 Paicines, California 1.33
July 1, 2015, 22:49:43 Mare Island, California 1.32
June 29, 2015, 11:03:05 Paicines, California 1.32
June 27, 2015, 22:00:49 Glenhaven, California 1.32
June 27, 2015, 3:19:30 Hollister, California 1.32
July 2, 2015, 21:43:57 Richmond, California 1.27
July 2, 2015, 8:14:21 Hayward, California 1.27
July 1, 2015, 22:26:38 Santa Rosa, California 1.24
June 30, 2015, 22:38:38 Paicines, California 1.24
June 30, 2015, 12:26:12 Aromas, California 1.22
July 2, 2015, 0:30:19 Paicines, California 1.21
June 27, 2015, 2:19:23 Firebaugh, California 1.21
June 30, 2015, 6:35:14 Hopland, California 1.2
June 28, 2015, 17:13:36 Parkfield, California 1.19
June 26, 2015, 22:23:31 American Canyon, California 1.1
June 29, 2015, 15:12:02 Santa Rosa, California 1.09
June 27, 2015, 16:27:11 Concord, California 1.09
June 27, 2015, 23:18:19 Calpine, California 1.08
June 27, 2015, 21:38:44 Paicines, California 1.06
June 30, 2015, 13:42:51 Paicines, California 1.05
July 2, 2015, 19:21:59 Fremont, California 1.03

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.