Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESRI Dump Internal JSON #55

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

ESRI Dump Internal JSON #55

wants to merge 6 commits into from

Conversation

ingalls
Copy link
Member

@ingalls ingalls commented Sep 19, 2023

Context

Update ESRI Dump to use GeoJSON internally

  • First step in fixing issues like: Update city_of_kingston.json openaddresses#6943
  • Output GeoJSON from ESRI Dump
  • Convert existing ESRI Dump fixtures to GeoJSON
  • Update GeoJSON parsing (geojson.py) to support FeatureCollection or Geojson+LD
  • Probably fix a lot of tests.

import fs from 'node:fs';

let file = String(fs.readFileSync('/home/null/Development/openaddresses/batch-machine/openaddr/tests/conforms/lake-man-split2.csv'))
    .split('\n')
    .map((line) => {
        return line.split(',');
    });

const headers = file.splice(0, 1)[0];
file.pop();

file = file.map((line) => {
    const res = {}
    for (let i = 0; i < headers.length; i++) {
        res[headers[i]] = line[i];
    }

    res['OA:x'] = Number(res['OA:x'])
    res['OA:y'] = Number(res['OA:y'])

    return {
        type: 'Feature',
        properties: res,
        geometry: {
            type: 'Point',
            coordinates: [ res['OA:x'], res['OA:y'] ]
        }
    };
});

console.log(file.map((line) => JSON.stringify(line)).join('\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant