Skip to content

Instantly share code, notes, and snippets.

View easherma's full-sized avatar
👋

Eric Sherman easherma

👋
View GitHub Profile
# my messy notes
The steps for fully installing Pelias look like this:
Decide which datasets and settings will be used
*
Download appropriate data
Download Pelias code, using the appropriate branches
Set up Elasticsearch
Install the Elasticsearch schema using pelias-schema
// read api doc:
// http://developer.factual.com/display/docs/Core+API+-+Read
var auth = require('./auth.js'); //or however you wanna auth
var Factual = require('factual-api');
var factual = new Factual(auth.key, auth.secret);
//factual.startDebug();
radius = 25000;
limit = 50;
//npm install knackhq-client
var knack = require('knackhq-client');
knack.authenticate({ apikey: 'edc09ff0-3cb5-11e6-a5db-e797893261f8', appid: '5771a671b3a24ed73cac0a5a' }, function(error) {
if (error) {
// failed to log in!
}
});
import requests
import json
import csv
import pandas as pd
address_list = 'sample.csv'
output_path = 'output.csv'
"""establishes the parameters for the api calls. atm they are decalred individually becuase the api needs them in a certain order.
this code can be compressed to sort the dict directly """
address city state
121 N LASALLE ST CHICAGO IL 60602
930 W 37TH PL CHICAGO IL 60609
127.0.0.1 - - [30/Jun/2016 13:40:44] "POST /call HTTP/1.1" 200 -
127.0.0.1 - - [30/Jun/2016 13:45:17] "GET /static/js/lrm-mapzen-0.1.2/leaflet.routing.icons.png HTTP/1.1" 200 -
{'status': 'OK', 'main': 2, 'sub': [], 'user': 'default'}
127.0.0.1 - - [30/Jun/2016 13:45:17] "POST /getParams HTTP/1.1" 200 -
<type 'dict'>
{"status": "OK", "main": 2, "sub": [4], "user": "EASHERMA"}
<type 'str'>
Using: Factual
route [{u'lat': 41.81173, u'lng': -87.666227}, {u'lat': 42.03831, u'lng': -88.290742}]
BEGIN:
all_results
run a call using params,
from that call, parse and store only the factual id and the POI name. do the page/offset thing to get 500 max records, in chunks of 50. Store these together
make another call with the same params, except filter by POI name NOTIN {our stored list} (the factual api dosen't let you filter this way by factual-id, boo)
see if we can get that in chunks of 500
do this until no new results are returned
store that in all results
this seems like it would have to go in order
for each in circleset:
var circle = L.circle([41.883842,-87.631655], 25000)
var bounds = circle.getBounds();
var rect = L.rectangle([bounds['_southWest'], bounds['_northEast']]);
inital bounds
http://jsfiddle.net/nathansnider/ts4oyyn0/ <--similar concept
Just using turf:
array of routepoints
* http://turfjs.org/docs/#point <--should be an unessary step, including for refrence
* either http://turfjs.org/docs/#buffer or http://turfjs.org/docs/#circle
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-97.904478, 30.208035]
},
"properties": {
"id": "85893511",