Git Product home page Git Product logo

addok-geocode-stream's Introduction

addok-geocode-stream

Node.js stream API for addok geocoder

Usage

CLI

Installation

npm install -g addok-geocode-stream

Documentation

$ addok-geocode --help
addok-geocode [options]

Options:
  --help               Show help                                       [boolean]
  --version            Show version number                             [boolean]
  --reverse            Reverse mode                                    [boolean]
  --service            Set geocoding service URL
                                   [default: "https://api-adresse.data.gouv.fr"]
  --strategy           Set geocoding strategy: csv, batch or cluster
                                                                [default: "csv"]
  --columns            Select columns to geocode, in the right order
  --citycode           Filter results by citycode
  --postcode           Filter results by postcode
  --lon                Define longitude column (geo affinity)
  --lat                Define latitude column (geo affinity)
  --semicolon, --semi  Use semicolon (;) as separator                  [boolean]
  --tab                Use tabulation as separator                     [boolean]
  --pipe               Use pipe as separator                           [boolean]
  --result             Select columns you want to be added to the result by the
                       geocoder. Default: all
  --bucket             Set how many rows are sent in each request
                                                         [number] [default: 200]
  --concurrency        Set how many requests must be executed concurrently
                                                                        [number]
  --encoding           Set data encoding. Can be detected automatically
                                                     [choices: "utf8", "latin1"]
  --clusterConfig      Path to addok config module (addok.conf)

Example

cat my-addresses.csv | addok-geocode --columns numero,voie,code_postal,ville --semicolon > my-geocoded-addresses.csv

addok-geocode-stream's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

addok-geocode-stream's Issues

Wrong args management for option --result

I got an issue using the tool

I'm using Node 16.13 on an Ubuntu 18.04

Running the following does not work

npm install -g addok-geocode-stream

wget https://gist.githubusercontent.com/ThomasG77/32329a8557135f11cb5656e3bfd4d35c/raw/9bd7883be31d2c9758d4393d72e9dc1ae4c5bed3/annuaire-des-debits-de-tabac-2018-utf8.csv
cat annuaire-des-debits-de-tabac-2018-utf8.csv | addok-geocode --encoding utf8 --columns adresse,code_postal,commune --semicolon

It returns

Options:
  --help               Show help                                       [boolean]
  --version            Show version number                             [boolean]
  --service            Set geocoding service URL
                                   [default: "https://api-adresse.data.gouv.fr"]
  --columns            Select columns to geocode, in the right order
  --citycode           Filter results by citycode
  --postcode           Filter results by postcode
  --semicolon, --semi  Use semicolon (;) as separator                  [boolean]
  --tab                Use tabulation as separator                     [boolean]
  --pipe               Use pipe as separator                           [boolean]
  --result             Select columns you want to be added to the result by the
                       geocoder. Default: all
  --bucket             Set how many rows are sent in each request
                                                         [number] [default: 200]
  --concurrency        Set how many requests must be executed concurrently
                                                         [number] [default: "1"]
  --encoding           Set data encoding. Can be detected automatically
                                                     [choices: "utf8", "latin1"]

Cannot read properties of undefined (reading 'split')

It's due to trying to split on undefined on arg option --results.
I've made a commit on a branch to solve the issue ThomasG77@5a20037

Before making a PR, I needed to confirm with you my diagnostic.

Issue on geocoder side when using header with a column named geocoder__line

How can I affirm this?

See my commit that described what happen at ThomasG77@dcabb3d and also reference a gist to reproduce the issue on the server side. In the gist, we demonstrate the issue only using curl and playing with csv with different headers name.

The fix is done on the client side as the column geocoder__line disappearance makes the code failing later and the renamed column does not appear in the end result.

What is more annoying is we got not idea why this behaviour happens on server side.

I can also make a PR using my commit, depending of your feedback. In this case, I will also change code in the tests https://github.com/jdesboeufs/addok-geocode-stream/blob/f312f219ecfedb3a87e34a461228cea308e8dc20/lib/__tests__/geocode.js

Inconsistant encoding and results

http://api-adresse.data.gouv.fr/search/?q=18%20boulevard%20Laromigui%C3%A8re%2012000%20RODEZ

vs.

echo 'adresse\n18 Boulevard Laromiguière 12000 Rodez' | ./cli.js

# adresse,latitude,longitude,result_label,result_score,result_type,result_id,result_housenumber,result_name,result_street,result_postcode,result_city,result_context,result_citycode,result_oldcitycode,result_oldcity,result_district
# 18 Boulevard Laromiguière 12000 Rodez,44.351057,2.577754,18 Boulevard de la R�publique 12000 Rodez,0.61,housenumber,12202_1580_00018,18,Boulevard de la R�publique,,12000,Rodez,"12, Aveyron, Occitanie",12202,,,


echo 'adresse,postcode\n18 Boulevard Laromiguière 12000 Rodez,12000' | ./cli.js --postcode postcode --columns adresse

# adresse,postcode,latitude,longitude,result_label,result_score,result_type,result_id,result_housenumber,result_name,result_street,result_postcode,result_city,result_context,result_citycode,result_oldcitycode,result_oldcity,result_district
# 18 Boulevard Laromiguière 12000 Rodez,12000,44.351057,2.577754,18 Boulevard de la République 12000 Rodez,0.61,housenumber,12202_1580_00018,18,Boulevard de la République,,12000,Rodez,"12, Aveyron, Occitanie",12202,,,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.