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

csvjson: Add support for non-Point GeoJSON types #866

Closed
jayvdb opened this issue Jul 24, 2017 · 1 comment
Closed

csvjson: Add support for non-Point GeoJSON types #866

jayvdb opened this issue Jul 24, 2017 · 1 comment
Labels
Milestone

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Jul 24, 2017

csvjoin fails if the --lon or --lat columns are empty, which is what in2csv -f geojson emits for non-Point

$ wget https://raw.githubusercontent.com/lyzidiamond/learn-geojson/master/geojson/pdxplaces.geojson
$ in2csv -f geojson pdxplaces.geojson > pdxplaces.csv
$ head -1  pdxplaces.csv
id,Name,Contributor,Reason,my polygon,Utility,Coffee,geojson,type,longitude,latitude
$ wc -l pdxplaces.csv
18 pdxplaces.csv
$ csvcut -c type,longitude,latitude pdxplaces.csv | csvgrep -c type -m Polygon | csvlook
| type    | longitude | latitude |
| ------- | --------- | -------- |
| Polygon |           |          |
| Polygon |           |          |
| Polygon |           |          |
$ grep Polygon pdxplaces.csv
[manually edited output for brevity]
...,Polygon,,
...,Polygon,,
...,Polygon,,
$ csvjson --lon longitude --lat latitude --indent=4 pdxplaces.csv > pdxplaces.csv.geojson
float() argument must be a string or a number, not 'NoneType'

Occurs in 1.0.2 and master.

It works when the Polygon's are removed

$ grep -v Polygon pdxplaces.csv > pdxplaces-points.csv
$ wc -l pdxplaces-points.csv 
15 pdxplaces-points.csv
$ csvjson --lon longitude --lat latitude --indent=4 pdxplaces-points.csv > pdxplaces.csv.geojson
@jayvdb
Copy link
Contributor Author

jayvdb commented Jul 24, 2017

I see csvjson also only knows how to emit a Point

('type', 'Point'),

jayvdb added a commit to jayvdb/csvkit that referenced this issue Jul 24, 2017
Parses and removes 'geojson' from the properties,
putting the coordinate into the GeoJSON feature geometry.

Fixes wireservice#866
@jpmckinney jpmckinney changed the title csvjson writing GeoJSON fails when type is not Point csvjson: Add support for non-Point GeoJSON types Jul 24, 2017
jayvdb added a commit to jayvdb/csvkit that referenced this issue Jul 26, 2017
Parses and removes 'geojson' from the properties,
putting the coordinate into the GeoJSON feature geometry.

Fixes wireservice#866
@jpmckinney jpmckinney added this to the 1.0.3 milestone Jan 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants