Skip to content

Instantly share code, notes, and snippets.

View easherma's full-sized avatar
👋

Eric Sherman easherma

👋
View GitHub Profile
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {
"response": "{\"address\":\"1480 Abbott Dr\",\"category_ids\":[6],\"category_labels\":[[\"Automotive\",\"Car Parts and Accessories\"]],\"chain_id\":\"ab4c25b0-d68a-012e-5619-003048cad9da\",\"chain_name\":\"NAPA Auto Parts\",\"country\":\"us\",\"email\":\"[email protected]\",\"factual_id\":\"62e993fb-795e-4a7d-af58-bea481cf6f3b\",\"fax\":\"(847) 888-6953\",\"hours\":{\"sunday\":[[\"9:00\",\"16:00\"]],\"saturday\":[[\"8:00\",\"17:00\"]],\"tuesday\":[[\"8:00\",\"19:30\"]],\"friday\":[[\"8:00\",\"19:30\"]],\"thursday\":[[\"8:00\",\"19:30\"]],\"wednesday\":[[\"8:00\",\"19:30\"]],\"monday\":[[\"8:00\",\"19:30\"]]},\"hours_display\":\"Mon-Fri 8:00 AM-7:30 PM; Sat 8:00 AM-5:00 PM; Sun 9:00 AM-4:00 PM\",\"latitude\":42.055655,\"locality\":\"Elgin\",\"longitude\":-88.314319,\"name\":\"NAPA Auto Parts\",\"postcode\":\"60123\",\"region\":\"IL\",\"tel\":\"(847) 697-3050\",\"website\":\"http://www.napaonline.com/\"}"
},
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {
"response": "{\"address\":\"1480 Abbott Dr\",\"category_ids\":[6],\"category_labels\":[[\"Automotive\",\"Car Parts and Accessories\"]],\"chain_id\":\"ab4c25b0-d68a-012e-5619-003048cad9da\",\"chain_name\":\"NAPA Auto Parts\",\"country\":\"us\",\"email\":\"[email protected]\",\"factual_id\":\"62e993fb-795e-4a7d-af58-bea481cf6f3b\",\"fax\":\"(847) 888-6953\",\"hours\":{\"sunday\":[[\"9:00\",\"16:00\"]],\"saturday\":[[\"8:00\",\"17:00\"]],\"tuesday\":[[\"8:00\",\"19:30\"]],\"friday\":[[\"8:00\",\"19:30\"]],\"thursday\":[[\"8:00\",\"19:30\"]],\"wednesday\":[[\"8:00\",\"19:30\"]],\"monday\":[[\"8:00\",\"19:30\"]]},\"hours_display\":\"Mon-Fri 8:00 AM-7:30 PM; Sat 8:00 AM-5:00 PM; Sun 9:00 AM-4:00 PM\",\"latitude\":42.055655,\"locality\":\"Elgin\",\"longitude\":-88.314319,\"name\":\"NAPA Auto Parts\",\"postcode\":\"60123\",\"region\":\"IL\",\"tel\":\"(847) 697-3050\",\"website\":\"http://www.napaonline.com/\"}"
},
{
"settings": {
"analysis": {
"tokenizer": {
"peliasNameTokenizer": {
"type": "pattern",
"pattern": "[\\s,/\\\\]+"
},
"peliasStreetTokenizer": {
"type": "pattern",
{
"pelias": {
"aliases": {},
"mappings": {
"venue": {
"dynamic": "true",
"_all": {
"enabled": false
},
"_source": {
factual.get('/t/places/facets',
{filters:{"category_ids":{"$includes_any":[2]}},
select:"category_labels", min_count:1,
geo:{"$within":{"$rect":[[bbox[3] , bbox[0]],[bbox[1], bbox[2]]]}}},
function (error, res) {
console.log(res.data);
});
/////////////////////////////////////////////////////////////////////////////////////////////
//setting up the map http://jsfiddle.net/fq7vu2rn/3///
/////////////////////////////////////////////////////////////////////////////////////////////
// set center coordinates
var centerlat = 41.81173;
var centerlon = -87.666227;
// set default zoom level
var zoomLevel = 10;
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-97.904478, 30.208035]
},
"properties": {
"id": "85893511",
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
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']]);
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