<commit_before># json-to-geo

Convert JSON objects into GeoJSON features

Input:

```json
{
	"meta": {
		"code": 200,
		"requestId": "57c63303498e78d449981c2c"
	},
	"response": {
		"venues": [{
			"id": "430d0a00f964a5203e271fe3",
			"name": "<NAME>",
			"location": {
				"address": "Main St",
				"crossStreet": "Plymouth St",
				"lat": 40.70303245363086,
				"lng": -73.99389265510275
			}
		}, {
			"id": "51eabef6498e10cf3aea7942",
			"name": "<NAME> - Pier 2",
			"contact": {},
			"location": {
				"address": "Furman St",
				"crossStreet": "Brooklyn Bridge Park Greenway",
				"lat": 40.69957016220183,
				"lng": -73.99793274204788
			}
		}]
	}
}
```

Output:

```json
[{
	"type": "Feature",
	"geometry": {
		"type": "Point",
		"coordinates": [-73.99389265510277, 40.703032453630854]
	},
	"properties": {
		"id": "430d0a00f964a5203e271fe3",
		"name": "<NAME>",
		"location": {
			"address": "Main St",
			"crossStreet": "Plymouth St",
			"lat": 40.703032453630854,
			"lng": -73.99389265510277
		}
	}
}, {
	"type": "Feature",
	"geometry": {
		"type": "Point",
		"coordinates": [-73.9979327420479, 40.69957016220184]
	},
	"properties": {
		"id": "51eabef6498e10cf3aea7942",
		"name": "Brooklyn Bridge Park - Pier 2",
		"location": {
			"address": "Furman St",
			"crossStreet": "Brooklyn Bridge Park Greenway",
			"lat": 40.69957016220184,
			"lng": -73.9979327420479
		}
	}
}]
```

Usage:

See [example.js](https://github.com/rodowi/json-to-geo/blob/master/example.js) or run `json-to-geo -h`.

From Javascript:
<commit_msg>Add info about accessor, paths, and streams to README<commit_after># json-to-geo

Convert JSON objects into GeoJSON features.

In the box:

- **An accessor function**: You can specify an accessor function to extract coordinates from custom locations, or leave this empty and let the module look for common property names.
- **Path to feature objects**: If the array of objects is in a deep property, you can specify a path string, e.g. `response.rows.*`. See [JSONStream](https://www.npmjs.com/package/jsonstream) for more info.
- **Streaming interface**: For fast command-line pipelines.

Input:

```json
{
	"meta": {
		"code": 200,
		"requestId": "57c63303498e78d449981c2c"
	},
	"response": {
		"venues": [{
			"id": "430d0a00f964a5203e271fe3",
			"name": "<NAME>",
			"location": {
				"address": "Main St",
				"crossStreet": "Plymouth St",
				"lat": 40.70303245363086,
				"lng": -73.99389265510275
			}
		}, {
			"id": "51eabef6498e10cf3aea7942",
			"name": "<NAME> - Pier 2",
			"contact": {},
			"location": {
				"address": "Furman St",
				"crossStreet": "Brooklyn Bridge Park Greenway",
				"lat": 40.69957016220183,
				"lng": -73.99793274204788
			}
		}]
	}
}
```

Output:

```json
[{
	"type": "Feature",
	"geometry": {
		"type": "Point",
		"coordinates": [-73.99389265510277, 40.703032453630854]
	},
	"properties": {
		"id": "430d0a00f964a5203e271fe3",
		"name": "<NAME>",
		"location": {
			"address": "Main St",
			"crossStreet": "Plymouth St",
			"lat": 40.703032453630854,
			"lng": -73.99389265510277
		}
	}
}, {
	"type": "Feature",
	"geometry": {
		"type": "Point",
		"coordinates": [-73.9979327420479, 40.69957016220184]
	},
	"properties": {
		"id": "51eabef6498e10cf3aea7942",
		"name": "<NAME> - Pier 2",
		"location": {
			"address": "Furman St",
			"crossStreet": "Brooklyn Bridge Park Greenway",
			"lat": 40.69957016220184,
			"lng": -73.9979327420479
		}
	}
}]
```

## Usage:

See [example.js](https://github.com/rodowi/json-to-geo/blob/master/example.js) or run `json-to-geo -h`.

### From Javascript:

{'fraction_non_alphanumeric': 0.19372021306419962, 'fraction_numerical': 0.15475189234650968, 'mean_word_length': 3.7258278145695365, 'pattern_counts': {'":': 88, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4751461', 'n_tokens_mistral': 1960, 'n_tokens_neox': 1467, 'n_words': 304}