Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

fixing geo.geohash table (using Google API directly, instead of google.geocoding table) #347

Open
wants to merge 25 commits into from

3 participants

@vicmortelmans

No description provided.

@pjdonnelly pjdonnelly closed this
@pjdonnelly pjdonnelly reopened this
@kenorb

Pull doesn't merge anymore. Needs to be re-rolled.
It's because you're changing the file which was already removed in commit 7fec1dc (geo/geo.geohash.xml).
Does your change fix the problem with geo.geohash.xml? Or it doesn't work at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 18, 2013
  1. @vicmortelmans
  2. @vicmortelmans
  3. @vicmortelmans
  4. @vicmortelmans
Commits on Apr 22, 2013
  1. @vicmortelmans
  2. @vicmortelmans
  3. @vicmortelmans
Commits on Jul 19, 2013
  1. @vicmortelmans

    added sequence to output

    vicmortelmans authored
  2. @vicmortelmans

    added sequence to output

    vicmortelmans authored
  3. @vicmortelmans

    added sequence to output

    vicmortelmans authored
Commits on Jul 22, 2013
  1. @vicmortelmans
Commits on Jul 28, 2013
  1. @vicmortelmans
  2. @vicmortelmans
  3. @vicmortelmans
  4. @vicmortelmans
  5. @vicmortelmans
Commits on Dec 29, 2013
  1. @vicmortelmans
  2. @vicmortelmans
Commits on Jan 5, 2014
  1. @vicmortelmans
  2. @vicmortelmans
  3. @vicmortelmans
  4. @vicmortelmans
Commits on Mar 5, 2014
  1. @vicmortelmans
Commits on Sep 29, 2014
  1. @vicmortelmans
Commits on Nov 7, 2014
  1. @vicmortelmans
This page is out of date. Refresh to see the latest.
View
24 bible/bible.bible.xml
@@ -22,20 +22,20 @@
<execute><![CDATA[
String.prototype.trim = function() {
// Strip leading and trailing white-space
- return this.replace(/^[ ]*|[ ]*$/g, "");
+ return this.replace(/^\s+|\s+$/g, "");
}
var debug = 0;
if (!edition && !language) {
language = "en";
}
- var editionsquery = 'select edition from xml where url="https://raw.github.com/vicmortelmans/BibleConfiguration/master/editions.xml" and edition.input like "%$edition%" and edition.language matches "(?i)$language"';
+ var editionsquery = 'select edition from xml where url="https://raw.githubusercontent.com/vicmortelmans/BibleConfiguration/master/editions.xml" and edition.input like "%$edition%" and edition.language matches "(?i)$language"';
editionsquery = editionsquery.replace("$language",language?language:'.*');
editionsquery = editionsquery.replace("$edition",edition?edition:'');
var editions = y.query(editionsquery).results.editions;
var edition;
if (editions.edition.length() < 1) {
- var supported_editionsquery = 'select edition from xml where url="https://raw.github.com/vicmortelmans/BibleConfiguration/master/editions.xml"';
+ var supported_editionsquery = 'select edition from xml where url="https://raw.githubusercontent.com/vicmortelmans/BibleConfiguration/master/editions.xml"';
var supported_editions = y.query(supported_editionsquery).results.editions;
y.log('No bible edition found matching query parameters. Supported editions and languages:');
y.log(listEditions(supported_editions));
@@ -71,8 +71,9 @@
<phrase/>
</bibleref>
</biblerefs>;
+ bibleref = book + ' ' + chapter + ':' + verse;
} else {
- var biblerefsquery = "use 'https://raw.github.com/vicmortelmans/yql-tables/master/bible/bibleref.xml' as bible.bibleref;select * from bible.bibleref where bibleref='$bibleref'";
+ var biblerefsquery = "use 'https://raw.githubusercontent.com/vicmortelmans/yql-tables/master/bible/bibleref.xml' as bible.bibleref;select * from bible.bibleref where bibleref='$bibleref'";
biblerefsquery = biblerefsquery.replace("$bibleref",bibleref);
biblerefsxml = y.query(biblerefsquery).results.biblerefs;
if (biblerefsxml.length() == 0) {
@@ -82,8 +83,13 @@
}
debug && y.log("Bible references: ");
debug && y.log(biblerefsxml);
+ var localbiblerefsquery = "use 'https://raw.githubusercontent.com/vicmortelmans/yql-tables/master/bible/bibleref.xml' as bible.bibleref;select * from bible.bibleref where bibleref='$bibleref' and language='$language'";
+ localbiblerefsquery = localbiblerefsquery.replace("$bibleref",bibleref);
+ localbiblerefsquery = localbiblerefsquery.replace("$language",language);
+ localbiblerefsxml = y.query(localbiblerefsquery).results.biblerefs;
+ localbibleref = localbiblerefsxml.bibleref[0].localbook + ' ' + localbiblerefsxml.bibleref[0].chapterversereference;
book = biblerefsxml.bibleref[0].book.toString();
- var booksquery = 'select book from xml where url="https://raw.github.com/vicmortelmans/BibleConfiguration/master/books.xml" and book.input matches "(?i)$book"';
+ var booksquery = 'select book from xml where url="https://raw.githubusercontent.com/vicmortelmans/BibleConfiguration/master/books.xml" and book.input matches "(?i)$book"';
booksquery = booksquery.replace("$book",book);
var books = y.query(booksquery).results.books;
if (books.book.length() < 1) {
@@ -95,7 +101,7 @@
}
book = books.book[0];
debug && y.log(book);
- var servicesquery = 'select service from xml where url="https://raw.github.com/vicmortelmans/BibleConfiguration/master/services.xml" and service.name matches "(?i)$service"';
+ var servicesquery = 'select service from xml where url="https://raw.githubusercontent.com/vicmortelmans/BibleConfiguration/master/services.xml" and service.name matches "(?i)$service"';
servicesquery = servicesquery.replace("$service",edition.code.(@default_ == "true").@service.toString());
var services = y.query(servicesquery).results.services;
if (services.service.length() < 1) {
@@ -150,7 +156,7 @@
queryoutput = queryoutput.trim();
var verseIndication = queryoutput.match(/^[0-9]+/);
if ( verseIndication && verseIndication[0] === biblerefxml.verse.toString()) {
- queryoutput = queryoutput.replace(/^[0-9]+/,'');
+ queryoutput = queryoutput.replace(/^[0-9]+[.\s]*/,'');
}
debug && y.log(queryoutput);
if (biblerefxml.phrase != '') {
@@ -160,6 +166,7 @@
output += (queryoutput + ' ');
}
output = output.trim();
+ output = output.replace(/\s+/g, ' ');
var punctuation = output.match(/[.?!,:;]$/);
if (!punctuation) {
output += '.';
@@ -167,6 +174,7 @@
else if (punctuation[0].match(/[,:;]/)) {
output = output.replace(/[,:;]$/,'.');
}
+ output = output.charAt(0).toUpperCase() + output.slice(1);
if ( -1 != output.indexOf("’") &&
-1 == output.substring(0,output.indexOf("’")).indexOf("‘") ) {
output = '‘' + output;
@@ -175,7 +183,7 @@
-1 == output.substring(output.lastIndexOf("‘"),output.length-1).indexOf("’") ) {
output += '’';
}
- response.object = <passage>{output}</passage>;
+ response.object = <passage bibleref={localbibleref}>{output}</passage>;
function stringValue(node) {
var value = new String();
View
12 bible/bibleref.xml
@@ -3,7 +3,7 @@
<meta>
<author>Vic Mortelmans</author>
<description>The table breaks down complex bible references to a list of references to single verses. Also includes the OSISid format of the verse references.</description>
- <sampleQuery>use "https://raw.github.com/vicmortelmans/yql-tables/master/bible/bibleref.xml" as bible.bibleref; select * from bible.bibleref where bibleref="john 3:16,17"</sampleQuery>
+ <sampleQuery>use "https://raw.githubusercontent.com/vicmortelmans/yql-tables/master/bible/bibleref.xml" as bible.bibleref; select * from bible.bibleref where bibleref="john 3:16,17"</sampleQuery>
<documentationURL>http://docs.google.com/View?id=ddq89pzk_200fmmzdthf</documentationURL>
</meta>
<bindings>
@@ -74,7 +74,7 @@
function bookquery(book)
{
var booksquery, books;
- booksquery = 'select book from xml where url="https://raw.github.com/vicmortelmans/BibleConfiguration/master/books.xml" and book.input matches "(?i)$book"';
+ booksquery = 'select book from xml where url="https://raw.githubusercontent.com/vicmortelmans/BibleConfiguration/master/books.xml" and book.input matches "(?i)$book"';
booksquery = booksquery.replace("$book",book);
books = y.query(booksquery).results.books;
if (books.book.length() < 1) {
@@ -97,7 +97,7 @@
function bookoutlinequery(osisbook)
{
var booksquery, books;
- booksquery = 'select book from xml where url="https://raw.github.com/vicmortelmans/BibleConfiguration/master/bible-outline.xml" and book.name = "$osisbook"';
+ booksquery = 'select book from xml where url="https://raw.githubusercontent.com/vicmortelmans/BibleConfiguration/master/bible-outline.xml" and book.name = "$osisbook"';
booksquery = booksquery.replace("$osisbook",osisbook);
books = y.query(booksquery).results.books;
if (books.book.length() < 1) {
@@ -130,6 +130,7 @@
<verse>{verse}</verse>
<phrase>{phrase}</phrase>
<osisref>{osisbook + '.' + chapter + '.' + verse + (phrase?'!':'') + phrase}</osisref>
+ <sequence>{osisbook + (1000000 + 1000 * chapter + verse)}</sequence>
</bibleref>;
}
function parse_reference(bibleref)
@@ -177,7 +178,10 @@
{
try
{
- chapterversereference = split2.after.replace(chapterseparator,':').replace(listseparator,',').replace(rangeseparator,'-');
+ chapterversereference = split2.after
+ .replace(new RegExp('\\' + chapterseparator,'g'),':')
+ .replace(new RegExp('\\' + listseparator,'g'),',')
+ .replace(new RegExp('\\' + rangeseparator,'g'),'-');
parseResult = parse_list("explicit",split2.after);
parseSuccess = 1;
}
View
6 data/twittertextfeed.xml
@@ -30,11 +30,11 @@ and length = "140"</sampleQuery>
//y.log(text.length());
var today = new Date();
- //y.log(today.toString());
+ y.log(today.toString());
var startdate = new Date(startdate);
- //y.log(startdate.toString());
+ y.log(startdate.toString());
var position = Math.floor((today.getTime() - startdate.getTime()) * frequency /1000/60/60/24) % text.length();
- //y.log(position);
+ y.log(position);
result = new XMLList();
for (i = Math.max(0,position-10); i <= position; i++) {
View
8 geo/geo.geohash.xml
@@ -26,12 +26,20 @@
lat = place.match(/^[0-9.]+/);
lon = place.match(/[0-9.]+$/);
} else {
+/* OLD CODE, BEFORE google.geocoding BROKE DOWN
var res = y.query("use 'http://www.datatables.org/google/google.geocoding.xml' as google.geocoding; select * from google.geocoding where q='" +
place + "'").results;
lat = res..Point.coordinates[1];
lon = res..Point.coordinates[0];
+*/
+ var req = y.rest("http://maps.googleapis.com/maps/api/geocode/xml?sensor=false&address=" + encodeURIComponent(place));
+ var res = req.get();
+ lat = res.response..geometry[0].location.lat;
+ lon = res.response..geometry[0].location.lng;
}
+ y.log("The geo.geohash YQL open table uses the Google Geocoding API, which is subject to usage limitations documented on the Google Developers website: https://developers.google.com/maps/documentation/geocoding/#Limits");
+
response.object = <item><geohash>{encodeGeoHash(lat,lon)}</geohash></item>;
// copied from https://github.com/davetroy/geohash-js/blob/master/geohash.js
Something went wrong with that request. Please try again.