Skip to content

Instantly share code, notes, and snippets.

@hkrishna
Last active August 29, 2015 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkrishna/d0a3ffab8160f1ddef0d to your computer and use it in GitHub Desktop.
Save hkrishna/d0a3ffab8160f1ddef0d to your computer and use it in GitHub Desktop.
Set up Pelias (Quick and Dirty)

mkdir pelias

Schema

git clone git@github.com:pelias/schema.git
npm install

install plugin

(if you used homebrew to install elasticsearch it should be /usr/local/Cellar/elasticsearch)

bin/plugin -url https://github.com/pelias/elasticsearch-plugin/blob/master/pelias-analysis.zip?raw=true -install pelias-analysis

[Restart ES]

node scripts/create_index.js;

geonames

git clone git@github.com:mapzen/pelias-geonames.git
cd pelias-geonames
npm install

./bin/pelias-geonames -i us

Quattroshapes

mkdir data
cd data
wget https://s3.amazonaws.com/peter.johnson/quattroshapes-simplified.tar.gz
gzip quattroshapes-simplified

git clone git@github.com:pelias/quattroshapes-pipeline.git && cd quattroshapes-pipeline
npm install

touch ~/pelias.json

make it look like (https://github.com/pelias/config/blob/master/config/local.json)

And then, run the following with example/runme.js. The json blob that follows each command is where the process exited out FYI.

node example/runme.js admin0
stats {
  "written": 331,
  "indexed": 35,
  "errored": 152,
  "retries": 19,
  "active_requests": 0,
  "queued": 144,
  "iops": 3,
  "retry_rate": "5.43%"
}
node example/runme.js admin1
stats {
  "written": 4694,
  "indexed": 0,
  "errored": 2281,
  "retries": 0,
  "active_requests": 5,
  "queued": 2413,
  "iops": 0,
  "retry_rate": 0
}
node example/runme.js admin2
stats {
  "written": 18214,
  "indexed": 0,
  "errored": 15583,
  "retries": 417,
  "active_requests": 6,
  "queued": 2631,
  "iops": 0,
  "retry_rate": "2.24%"
}
node example/runme.js local_admin
stats {
  "written": 110142,
  "indexed": 10949,
  "errored": 96312,
  "retries": 55570,
  "active_requests": 4,
  "queued": 2881,
  "iops": 0,
  "retry_rate": "33.53%"
}
node example/runme.js locality
stats {
  "written": 163385,
  "indexed": 139995,
  "errored": 23035,
  "retries": 10268,
  "active_requests": 1,
  "queued": 355,
  "iops": 0,
  "retry_rate": "5.91%"
}

errored out here:

{ [Error: MapperParsingException[failed to parse [boundaries]]; nested: InvalidShapeException[Ring Self-intersection at or near point (139.943847656, 35.889050079400036, NaN)]; ]
  message: 'MapperParsingException[failed to parse [boundaries]]; nested: InvalidShapeException[Ring Self-intersection at or near point (139.943847656, 35.889050079400036, NaN)]; ',
  req: 
   { name: { default: 'Kashiwa', alt: '柏市' },
     alpha3: undefined,
     admin0: 'Japan',
     admin1: '千葉県',
     admin2: undefined,
     gn_id: 1859924,
     woe_id: NaN,
     boundaries: { type: 'Polygon', coordinates: [Object] },
     center_point: { lat: '35.866830', lon: '139.968169' },
     suggest: 
      { input: [Object],
        payload: [Object],
        output: 'Kashiwa, 千葉県',
        weight: 12 } },
  res: 
   { index: 
      { _index: 'pelias',
        _type: 'locality',
        _id: '163071:locality:j:jp:kashiwa',
        status: 400,
        error: 'MapperParsingException[failed to parse [boundaries]]; nested: InvalidShapeException[Ring Self-intersection at or near point (139.943847656, 35.889050079400036, NaN)]; ' } } }
node example/runme.js neighborhood
stats {
  "written": 49906,
  "indexed": 49241,
  "errored": 259,
  "retries": 0,
  "active_requests": 1,
  "queued": 406,
  "iops": 0,
  "retry_rate": 0
}

errored out here:

{ [Error: MapperParsingException[failed to parse [boundaries]]; nested: ArrayIndexOutOfBoundsException; ]
  message: 'MapperParsingException[failed to parse [boundaries]]; nested: ArrayIndexOutOfBoundsException; ',
  req: 
   { name: { default: 'Alte Drusel' },
     alpha3: undefined,
     admin0: 'Deutschland',
     admin1: 'Hessen',
     admin2: 'Stadtkreis Kassel',
     gn_id: 2957973,
     woe_id: 26822706,
     boundaries: { type: 'Polygon', coordinates: [Object] },
     center_point: { lat: '51.299708', lon: '9.349858' },
     suggest: 
      { input: [Object],
        payload: [Object],
        output: 'Alte Drusel, Stadtkreis Kassel, Hessen',
        weight: 10 } },
  res: 
   { index: 
      { _index: 'pelias',
        _type: 'neighborhood',
        _id: '49900:_:_:_:alte_drusel',
        status: 400,
        error: 'MapperParsingException[failed to parse [boundaries]]; nested: ArrayIndexOutOfBoundsException; ' } } }

OSM

git clone git@github.com:mapzen/pelias-openstreetmap.git
cd pelias-openstreetmap
npm install

cd ~/pelias/data
wget https://s3.amazonaws.com/metro-extracts.mapzen.com/new-york_new-york.osm.pbf

node index.js
stats {
  "written": 905748,
  "indexed": 905746,
  "errored": 2,
  "retries": 0,
  "active_requests": 0,
  "queued": 0,
  "iops": 423,
  "retry_rate": 0
}

and then you see a lot of these..

{
  "reader -> osm_types": 1185,
  "osm_types -> node_centroid_cache": 8114285,
  "node_centroid_cache -> node_filter": 8114285,
  "node_filter -> node_mapper": 156526,
  "node_mapper -> node_hierarchyLookup": 156526,
  "node_hierarchyLookup -> node_meta.type": 156526,
  "node_meta.type -> node_address_extractor": 156526,
  "node_address_extractor -> node_suggester": 159674,
  "node_suggester -> node_whitelist": 159674,
  "node_blacklist -> es_osmnode_backend": 159674,
  "osm_types -> way_filter": 1261876,
  "way_filter -> way_mapper": 741996,
  "way_mapper -> way_denormalizer": 741932,
  "way_denormalizer -> way_hierarchyLookup": 741869,
  "way_hierarchyLookup -> way_meta.type": 741845,
  "way_meta.type -> way_address_extractor": 741845,
  "way_address_extractor -> way_suggester": 746113,
  "way_suggester -> way_blacklist": 746113,
  "way_blacklist -> es_osmway_backend": 746113
}

API

git clone git@github.com:pelias/api.git && cd api
npm install
node index.js

Demo

git clone git@github.com:pelias/demo.git
cd demo
./server.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment