Skip to content

A simple script for parsing geojson files and converting them to CSV files ready to upload to GCP BigQuery.

License

Notifications You must be signed in to change notification settings

datasciencecampus/geojson_to_csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple script for parsing geojson files and converting them to CSV files ready to upload to GCP BigQuery.

This will convert POINT, POLYGON and MULTIPOLYGON feature types.

Standard GeoJSON file structure

{"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[[-2.03,55.77],[-2.02,55.77],[-2.03,55.77],[-2.04,55.76],[-2.05,55.76],[-2.07,55.76],[-2.09,55.76],[-2.24,55.65],[-2.33,55.63],[-2.31,55.62],[-2.23,55.52],[-2.2,55.48],[-2.18,55.47],[-2.33,55.41],[-2.34,55.39],[-2.33,55.39],[-2.34,55.39],[-2.33,55.39],[-2.34,55.37],[-2.64,55.26],[-2.63,55.25],[-2.63,55.23],[-2.69,55.19],[-2.53,55.08],[-2.53,55.09],[-2.53,55.08],[-2.53,55.09],[-2.52,55.09],[-2.5,55.09],[-2.49,55.09],[-2.5,55.09],[-2.49,55.09],[-2.5,55.07],[-2.51,55.04],[-2.51,55.03],[-2.51,55.04],[-2.51,55.03],[-2.6,54.97],[-2.6,54.96],[-2.6,54.97],[-2.6,54.96],[-2.41,54.85],[-2.33,54.81],[-2.33,54.8],[-2.33,54.81],[-2.33,54.8],[-2.33,54.81],[-2.33,54.8],[-2.34,54.71],[-2.35,54.7],[-2.16,54.46],[-2.17,54.46],[-2.16,54.46],[-1.79,54.49],[-1.66,54.53],[-1.64,54.52],[-1.59,54.51],[-1.58,54.51],[-1.59,54.51],[-1.58,54.5],[-1.58,54.51],[-1.58,54.5],[-1.53,54.47],[-1.52,54.48],[-1.5,54.48],[-1.48,54.47],[-1.46,54.5],[-1.34,54.47],[-1.26,54.5],[-1.25,54.5],[-1.26,54.5],[-1.25,54.5],[-0.88,54.5],[-0.88,54.49],[-0.88,54.5],[-0.88,54.49],[-0.85,54.49],[-0.8,54.55],[-0.8,54.56],[-0.8,54.55],[-0.8,54.56],[-0.79,54.56],[-0.8,54.56],[-0.9,54.57],[-0.9,54.58],[-0.9,54.57],[-0.9,54.58],[-0.96,54.59],[-1.13,54.64],[-1.14,54.64],[-1.13,54.64],[-1.14,54.64],[-1.15,54.61],[-1.14,54.61],[-1.15,54.61],[-1.16,54.61],[-1.16,54.6],[-1.17,54.6],[-1.18,54.59],[-1.19,54.59],[-1.18,54.59],[-1.19,54.59],[-1.19,54.58],[-1.2,54.58],[-1.19,54.58],[-1.2,54.58],[-1.21,54.58],[-1.2,54.58],[-1.21,54.58],[-1.2,54.58],[-1.21,54.58],[-1.22,54.58],[-1.23,54.59],[-1.26,54.58],[-1.26,54.57],[-1.28,54.56],[-1.27,54.55],[-1.28,54.56],[-1.26,54.57],[-1.27,54.58],[-1.26,54.58],[-1.27,54.58],[-1.29,54.58],[-1.29,54.59],[-1.29,54.58],[-1.29,54.59],[-1.29,54.58],[-1.27,54.58],[-1.26,54.58],[-1.26,54.57],[-1.26,54.58],[-1.23,54.59],[-1.22,54.58],[-1.21,54.58],[-1.2,54.58],[-1.19,54.59],[-1.18,54.59],[-1.17,54.6],[-1.16,54.61],[-1.17,54.62],[-1.17,54.63],[-1.17,54.62],[-1.2,54.62],[-1.22,54.62],[-1.23,54.62],[-1.23,54.63],[-1.23,54.62],[-1.22,54.62],[-1.23,54.62],[-1.22,54.62],[-1.23,54.62],[-1.23,54.63],[-1.23,54.62],[-1.23,54.63],[-1.23,54.62],[-1.23,54.63],[-1.24,54.63],[-1.23,54.63],[-1.24,54.63],[-1.23,54.63],[-1.22,54.63],[-1.22,54.62],[-1.22,54.63],[-1.22,54.62],[-1.22,54.63],[-1.22,54.62],[-1.22,54.63],[-1.22,54.62],[-1.2,54.62],[-1.17,54.63],[-1.17,54.65],[-1.2,54.69],[-1.19,54.69],[-1.2,54.69],[-1.19,54.69],[-1.2,54.69],[-1.19,54.69],[-1.19,54.7],[-1.2,54.7],[-1.19,54.7],[-1.2,54.7],[-1.32,54.83],[-1.32,54.84],[-1.32,54.83],[-1.32,54.84],[-1.33,54.84],[-1.32,54.84],[-1.33,54.84],[-1.32,54.84],[-1.33,54.84],[-1.32,54.84],[-1.33,54.84],[-1.36,54.88],[-1.35,54.9],[-1.35,54.91],[-1.35,54.9],[-1.36,54.91],[-1.35,54.91],[-1.36,54.91],[-1.35,54.91],[-1.35,54.92],[-1.36,54.91],[-1.36,54.92],[-1.36,54.91],[-1.37,54.91],[-1.43,54.92],[-1.44,54.91],[-1.43,54.92],[-1.37,54.91],[-1.37,54.92],[-1.36,54.92],[-1.35,54.92],[-1.36,54.92],[-1.37,54.92],[-1.36,54.96],[-1.41,55.01],[-1.4,55.01],[-1.41,55.01],[-1.42,55.01],[-1.43,55.01],[-1.42,55.01],[-1.43,55.01],[-1.44,55.01],[-1.44,55],[-1.44,54.99],[-1.45,54.99],[-1.44,54.99],[-1.45,54.99],[-1.46,54.99],[-1.46,54.98],[-1.47,54.98],[-1.47,54.99],[-1.47,54.98],[-1.46,54.98],[-1.47,54.98],[-1.47,54.99],[-1.5,54.99],[-1.51,54.99],[-1.52,54.99],[-1.53,54.98],[-1.54,54.96],[-1.57,54.96],[-1.58,54.97],[-1.59,54.97],[-1.61,54.97],[-1.62,54.96],[-1.63,54.96],[-1.64,54.96],[-1.63,54.96],[-1.64,54.96],[-1.63,54.96],[-1.63,54.95],[-1.63,54.96],[-1.64,54.96],[-1.67,54.96],[-1.68,54.96],[-1.69,54.96],[-1.68,54.96],[-1.69,54.96],[-1.68,54.96],[-1.69,54.96],[-1.68,54.96],[-1.69,54.96],[-1.69,54.97],[-1.7,54.97],[-1.71,54.97],[-1.72,54.97],[-1.73,54.97],[-1.72,54.97],[-1.73,54.97],[-1.72,54.97],[-1.71,54.97],[-1.7,54.97],[-1.71,54.97],[-1.7,54.97],[-1.69,54.97],[-1.67,54.96],[-1.64,54.96],[-1.63,54.96],[-1.62,54.96],[-1.61,54.97],[-1.59,54.97],[-1.58,54.97],[-1.57,54.96],[-1.54,54.96],[-1.53,54.98],[-1.53,54.99],[-1.53,54.98],[-1.53,54.99],[-1.52,54.99],[-1.51,54.99],[-1.5,54.99],[-1.51,54.99],[-1.5,54.99],[-1.47,54.99],[-1.46,54.99],[-1.45,54.99],[-1.45,55],[-1.45,54.99],[-1.46,54.99],[-1.46,55],[-1.45,55],[-1.46,55],[-1.45,55],[-1.46,55],[-1.45,55],[-1.44,55],[-1.44,55.01],[-1.43,55.01],[-1.44,55.01],[-1.43,55.01],[-1.42,55.01],[-1.42,55.02],[-1.41,55.02],[-1.41,55.01],[-1.4,55.01],[-1.41,55.02],[-1.42,55.02],[-1.43,55.03],[-1.43,55.04],[-1.43,55.03],[-1.43,55.04],[-1.45,55.06],[-1.47,55.08],[-1.47,55.09],[-1.47,55.08],[-1.47,55.09],[-1.5,55.12],[-1.49,55.12],[-1.5,55.12],[-1.49,55.12],[-1.5,55.12],[-1.5,55.13],[-1.51,55.13],[-1.52,55.14],[-1.53,55.14],[-1.55,55.13],[-1.55,55.14],[-1.53,55.14],[-1.55,55.14],[-1.53,55.14],[-1.52,55.14],[-1.51,55.13],[-1.5,55.13],[-1.49,55.12],[-1.5,55.13],[-1.51,55.13],[-1.52,55.14],[-1.52,55.16],[-1.51,55.18],[-1.51,55.19],[-1.51,55.18],[-1.5,55.19],[-1.51,55.19],[-1.5,55.19],[-1.57,55.34],[-1.58,55.34],[-1.59,55.34],[-1.58,55.34],[-1.59,55.34],[-1.6,55.34],[-1.61,55.34],[-1.6,55.34],[-1.59,55.34],[-1.6,55.34],[-1.6,55.35],[-1.6,55.34],[-1.59,55.34],[-1.6,55.34],[-1.59,55.34],[-1.58,55.34],[-1.57,55.34],[-1.58,55.34],[-1.59,55.34],[-1.6,55.35],[-1.61,55.38],[-1.62,55.38],[-1.61,55.38],[-1.62,55.38],[-1.61,55.38],[-1.62,55.38],[-1.61,55.38],[-1.62,55.38],[-1.61,55.38],[-1.62,55.38],[-1.61,55.38],[-1.62,55.38],[-1.61,55.38],[-1.62,55.38],[-1.61,55.38],[-1.62,55.38],[-1.61,55.38],[-1.62,55.38],[-1.62,55.39],[-1.62,55.38],[-1.62,55.39],[-1.62,55.4],[-1.61,55.4],[-1.62,55.4],[-1.61,55.4],[-1.61,55.39],[-1.61,55.4],[-1.62,55.4],[-1.61,55.4],[-1.61,55.39],[-1.62,55.39],[-1.62,55.4],[-1.62,55.39],[-1.61,55.39],[-1.61,55.38],[-1.61,55.39],[-1.58,55.41],[-1.62,55.51],[-1.62,55.52],[-1.63,55.55],[-1.75,55.62],[-1.77,55.61],[-1.78,55.61],[-1.77,55.61],[-1.78,55.61],[-1.78,55.62],[-1.76,55.62],[-1.75,55.62],[-1.76,55.62],[-1.78,55.65],[-1.79,55.65],[-1.78,55.65],[-1.79,55.65],[-1.79,55.66],[-1.79,55.65],[-1.81,55.64],[-1.81,55.63],[-1.81,55.64],[-1.81,55.63],[-1.82,55.63],[-1.82,55.64],[-1.82,55.63],[-1.82,55.64],[-1.84,55.64],[-1.85,55.65],[-1.84,55.64],[-1.85,55.65],[-1.86,55.66],[-1.86,55.67],[-1.86,55.66],[-1.86,55.67],[-1.87,55.67],[-1.86,55.67],[-1.87,55.67],[-1.86,55.67],[-1.87,55.67],[-1.87,55.68],[-1.88,55.68],[-1.88,55.69],[-1.88,55.68],[-1.88,55.69],[-1.88,55.68],[-1.88,55.69],[-1.88,55.68],[-1.87,55.68],[-1.87,55.69],[-1.88,55.69],[-1.87,55.69],[-1.99,55.76],[-2.01,55.76],[-2.01,55.77],[-2.01,55.76],[-2.01,55.77],[-2.02,55.77],[-2.03,55.77]]],[[[-2.03,55.81],[-2.04,55.81],[-2.09,55.76],[-2.07,55.76],[-2.05,55.76],[-2.07,55.76],[-2.05,55.76],[-2.04,55.76],[-2.05,55.76],[-2.04,55.76],[-2.03,55.77],[-2.02,55.77],[-2.01,55.77],[-2,55.77],[-2.01,55.77],[-2,55.77],[-1.99,55.76],[-2,55.77],[-2,55.78],[-2.03,55.81]]],[[[-1.78,55.68],[-1.8,55.67],[-1.79,55.67],[-1.8,55.67],[-1.79,55.67],[-1.78,55.68]]]]},"properties":{"objectid":1,"rgn19cd":"E12000001","rgn19nm":"North East","bng_e":417314,"bng_n":600356,"long":-1.72888,"lat":55.297009,"st_areashape":8597297768.275003,"st_lengthshape":1032343.6839208059}},

GeoJSON CSV file structure

rgn19nm,objectid,bng_e,st_areashape,long,rgn19cd,lat,st_lengthshape,bng_n,geometry
1,E12000001,North East,417314,600356,-1.72888,55.297009,8597297768.275003,1032343.6839208059,"{""type"":""MultiPolygon"",""coordinates"":[[[[-2.03, 55.77], [-2.02, 55.77], [-2.03, 55.77], [-2.04, 55.76], [-2.05, 55.76], [-2.07, 55.76], [-2.09, 55.76], [-2.24, 55.65], [-2.33, 55.63], [-2.31, 55.62], [-2.23, 55.52], [-2.2, 55.48], [-2.18, 55.47], [-2.33, 55.41], [-2.34, 55.39], [-2.33, 55.39], [-2.34, 55.39], [-2.33, 55.39], [-2.34, 55.37], [-2.64, 55.26], [-2.63, 55.25], [-2.63, 55.23], [-2.69, 55.19], [-2.53, 55.08], [-2.53, 55.09], [-2.53, 55.08], [-2.53, 55.09], [-2.52, 55.09], [-2.5, 55.09], [-2.49, 55.09], [-2.5, 55.09], [-2.49, 55.09], [-2.5, 55.07], [-2.51, 55.04], [-2.51, 55.03], [-2.51, 55.04], [-2.51, 55.03], [-2.6, 54.97], [-2.6, 54.96], [-2.6, 54.97], [-2.6, 54.96], [-2.41, 54.85], [-2.33, 54.81], [-2.33, 54.8], [-2.33, 54.81], [-2.33, 54.8], [-2.33, 54.81], [-2.33, 54.8], [-2.34, 54.71], [-2.35, 54.7], [-2.16, 54.46], [-2.17, 54.46], [-2.16, 54.46], [-1.79, 54.49], [-1.66, 54.53], [-1.64, 54.52], [-1.59, 54.51], [-1.58, 54.51], [-1.59, 54.51], [-1.58, 54.5], [-1.58, 54.51], [-1.58, 54.5], [-1.53, 54.47], [-1.52, 54.48], [-1.5, 54.48], [-1.48, 54.47], [-1.46, 54.5], [-1.34, 54.47], [-1.26, 54.5], [-1.25, 54.5], [-1.26, 54.5], [-1.25, 54.5], [-0.88, 54.5], [-0.88, 54.49], [-0.88, 54.5], [-0.88, 54.49], [-0.85, 54.49], [-0.8, 54.55], [-0.8, 54.56], [-0.8, 54.55], [-0.8, 54.56], [-0.79, 54.56], [-0.8, 54.56], [-0.9, 54.57], [-0.9, 54.58], [-0.9, 54.57], [-0.9, 54.58], [-0.96, 54.59], [-1.13, 54.64], [-1.14, 54.64], [-1.13, 54.64], [-1.14, 54.64], [-1.15, 54.61], [-1.14, 54.61], [-1.15, 54.61], [-1.16, 54.61], [-1.16, 54.6], [-1.17, 54.6], [-1.18, 54.59], [-1.19, 54.59], [-1.18, 54.59], [-1.19, 54.59], [-1.19, 54.58], [-1.2, 54.58], [-1.19, 54.58], [-1.2, 54.58], [-1.21, 54.58], [-1.2, 54.58], [-1.21, 54.58], [-1.2, 54.58], [-1.21, 54.58], [-1.22, 54.58], [-1.23, 54.59], [-1.26, 54.58], [-1.26, 54.57], [-1.28, 54.56], [-1.27, 54.55], [-1.28, 54.56], [-1.26, 54.57], [-1.27, 54.58], [-1.26, 54.58], [-1.27, 54.58], [-1.29, 54.58], [-1.29, 54.59], [-1.29, 54.58], [-1.29, 54.59], [-1.29, 54.58], [-1.27, 54.58], [-1.26, 54.58], [-1.26, 54.57], [-1.26, 54.58], [-1.23, 54.59], [-1.22, 54.58], [-1.21, 54.58], [-1.2, 54.58], [-1.19, 54.59], [-1.18, 54.59], [-1.17, 54.6], [-1.16, 54.61], [-1.17, 54.62], [-1.17, 54.63], [-1.17, 54.62], [-1.2, 54.62], [-1.22, 54.62], [-1.23, 54.62], [-1.23, 54.63], [-1.23, 54.62], [-1.22, 54.62], [-1.23, 54.62], [-1.22, 54.62], [-1.23, 54.62], [-1.23, 54.63], [-1.23, 54.62], [-1.23, 54.63], [-1.23, 54.62], [-1.23, 54.63], [-1.24, 54.63], [-1.23, 54.63], [-1.24, 54.63], [-1.23, 54.63], [-1.22, 54.63], [-1.22, 54.62], [-1.22, 54.63], [-1.22, 54.62], [-1.22, 54.63], [-1.22, 54.62], [-1.22, 54.63], [-1.22, 54.62], [-1.2, 54.62], [-1.17, 54.63], [-1.17, 54.65], [-1.2, 54.69], [-1.19, 54.69], [-1.2, 54.69], [-1.19, 54.69], [-1.2, 54.69], [-1.19, 54.69], [-1.19, 54.7], [-1.2, 54.7], [-1.19, 54.7], [-1.2, 54.7], [-1.32, 54.83], [-1.32, 54.84], [-1.32, 54.83], [-1.32, 54.84], [-1.33, 54.84], [-1.32, 54.84], [-1.33, 54.84], [-1.32, 54.84], [-1.33, 54.84], [-1.32, 54.84], [-1.33, 54.84], [-1.36, 54.88], [-1.35, 54.9], [-1.35, 54.91], [-1.35, 54.9], [-1.36, 54.91], [-1.35, 54.91], [-1.36, 54.91], [-1.35, 54.91], [-1.35, 54.92], [-1.36, 54.91], [-1.36, 54.92], [-1.36, 54.91], [-1.37, 54.91], [-1.43, 54.92], [-1.44, 54.91], [-1.43, 54.92], [-1.37, 54.91], [-1.37, 54.92], [-1.36, 54.92], [-1.35, 54.92], [-1.36, 54.92], [-1.37, 54.92], [-1.36, 54.96], [-1.41, 55.01], [-1.4, 55.01], [-1.41, 55.01], [-1.42, 55.01], [-1.43, 55.01], [-1.42, 55.01], [-1.43, 55.01], [-1.44, 55.01], [-1.44, 55], [-1.44, 54.99], [-1.45, 54.99], [-1.44, 54.99], [-1.45, 54.99], [-1.46, 54.99], [-1.46, 54.98], [-1.47, 54.98], [-1.47, 54.99], [-1.47, 54.98], [-1.46, 54.98], [-1.47, 54.98], [-1.47, 54.99], [-1.5, 54.99], [-1.51, 54.99], [-1.52, 54.99], [-1.53, 54.98], [-1.54, 54.96], [-1.57, 54.96], [-1.58, 54.97], [-1.59, 54.97], [-1.61, 54.97], [-1.62, 54.96], [-1.63, 54.96], [-1.64, 54.96], [-1.63, 54.96], [-1.64, 54.96], [-1.63, 54.96], [-1.63, 54.95], [-1.63, 54.96], [-1.64, 54.96], [-1.67, 54.96], [-1.68, 54.96], [-1.69, 54.96], [-1.68, 54.96], [-1.69, 54.96], [-1.68, 54.96], [-1.69, 54.96], [-1.68, 54.96], [-1.69, 54.96], [-1.69, 54.97], [-1.7, 54.97], [-1.71, 54.97], [-1.72, 54.97], [-1.73, 54.97], [-1.72, 54.97], [-1.73, 54.97], [-1.72, 54.97], [-1.71, 54.97], [-1.7, 54.97], [-1.71, 54.97], [-1.7, 54.97], [-1.69, 54.97], [-1.67, 54.96], [-1.64, 54.96], [-1.63, 54.96], [-1.62, 54.96], [-1.61, 54.97], [-1.59, 54.97], [-1.58, 54.97], [-1.57, 54.96], [-1.54, 54.96], [-1.53, 54.98], [-1.53, 54.99], [-1.53, 54.98], [-1.53, 54.99], [-1.52, 54.99], [-1.51, 54.99], [-1.5, 54.99], [-1.51, 54.99], [-1.5, 54.99], [-1.47, 54.99], [-1.46, 54.99], [-1.45, 54.99], [-1.45, 55], [-1.45, 54.99], [-1.46, 54.99], [-1.46, 55], [-1.45, 55], [-1.46, 55], [-1.45, 55], [-1.46, 55], [-1.45, 55], [-1.44, 55], [-1.44, 55.01], [-1.43, 55.01], [-1.44, 55.01], [-1.43, 55.01], [-1.42, 55.01], [-1.42, 55.02], [-1.41, 55.02], [-1.41, 55.01], [-1.4, 55.01], [-1.41, 55.02], [-1.42, 55.02], [-1.43, 55.03], [-1.43, 55.04], [-1.43, 55.03], [-1.43, 55.04], [-1.45, 55.06], [-1.47, 55.08], [-1.47, 55.09], [-1.47, 55.08], [-1.47, 55.09], [-1.5, 55.12], [-1.49, 55.12], [-1.5, 55.12], [-1.49, 55.12], [-1.5, 55.12], [-1.5, 55.13], [-1.51, 55.13], [-1.52, 55.14], [-1.53, 55.14], [-1.55, 55.13], [-1.55, 55.14], [-1.53, 55.14], [-1.55, 55.14], [-1.53, 55.14], [-1.52, 55.14], [-1.51, 55.13], [-1.5, 55.13], [-1.49, 55.12], [-1.5, 55.13], [-1.51, 55.13], [-1.52, 55.14], [-1.52, 55.16], [-1.51, 55.18], [-1.51, 55.19], [-1.51, 55.18], [-1.5, 55.19], [-1.51, 55.19], [-1.5, 55.19], [-1.57, 55.34], [-1.58, 55.34], [-1.59, 55.34], [-1.58, 55.34], [-1.59, 55.34], [-1.6, 55.34], [-1.61, 55.34], [-1.6, 55.34], [-1.59, 55.34], [-1.6, 55.34], [-1.6, 55.35], [-1.6, 55.34], [-1.59, 55.34], [-1.6, 55.34], [-1.59, 55.34], [-1.58, 55.34], [-1.57, 55.34], [-1.58, 55.34], [-1.59, 55.34], [-1.6, 55.35], [-1.61, 55.38], [-1.62, 55.38], [-1.61, 55.38], [-1.62, 55.38], [-1.61, 55.38], [-1.62, 55.38], [-1.61, 55.38], [-1.62, 55.38], [-1.61, 55.38], [-1.62, 55.38], [-1.61, 55.38], [-1.62, 55.38], [-1.61, 55.38], [-1.62, 55.38], [-1.61, 55.38], [-1.62, 55.38], [-1.61, 55.38], [-1.62, 55.38], [-1.62, 55.39], [-1.62, 55.38], [-1.62, 55.39], [-1.62, 55.4], [-1.61, 55.4], [-1.62, 55.4], [-1.61, 55.4], [-1.61, 55.39], [-1.61, 55.4], [-1.62, 55.4], [-1.61, 55.4], [-1.61, 55.39], [-1.62, 55.39], [-1.62, 55.4], [-1.62, 55.39], [-1.61, 55.39], [-1.61, 55.38], [-1.61, 55.39], [-1.58, 55.41], [-1.62, 55.51], [-1.62, 55.52], [-1.63, 55.55], [-1.75, 55.62], [-1.77, 55.61], [-1.78, 55.61], [-1.77, 55.61], [-1.78, 55.61], [-1.78, 55.62], [-1.76, 55.62], [-1.75, 55.62], [-1.76, 55.62], [-1.78, 55.65], [-1.79, 55.65], [-1.78, 55.65], [-1.79, 55.65], [-1.79, 55.66], [-1.79, 55.65], [-1.81, 55.64], [-1.81, 55.63], [-1.81, 55.64], [-1.81, 55.63], [-1.82, 55.63], [-1.82, 55.64], [-1.82, 55.63], [-1.82, 55.64], [-1.84, 55.64], [-1.85, 55.65], [-1.84, 55.64], [-1.85, 55.65], [-1.86, 55.66], [-1.86, 55.67], [-1.86, 55.66], [-1.86, 55.67], [-1.87, 55.67], [-1.86, 55.67], [-1.87, 55.67], [-1.86, 55.67], [-1.87, 55.67], [-1.87, 55.68], [-1.88, 55.68], [-1.88, 55.69], [-1.88, 55.68], [-1.88, 55.69], [-1.88, 55.68], [-1.88, 55.69], [-1.88, 55.68], [-1.87, 55.68], [-1.87, 55.69], [-1.88, 55.69], [-1.87, 55.69], [-1.99, 55.76], [-2.01, 55.76], [-2.01, 55.77], [-2.01, 55.76], [-2.01, 55.77], [-2.02, 55.77], [-2.03, 55.77]]],[[[-2.03, 55.81], [-2.04, 55.81], [-2.09, 55.76], [-2.07, 55.76], [-2.05, 55.76], [-2.07, 55.76], [-2.05, 55.76], [-2.04, 55.76], [-2.05, 55.76], [-2.04, 55.76], [-2.03, 55.77], [-2.02, 55.77], [-2.01, 55.77], [-2, 55.77], [-2.01, 55.77], [-2, 55.77], [-1.99, 55.76], [-2, 55.77], [-2, 55.78], [-2.03, 55.81]]],[[[-1.78, 55.68], [-1.8, 55.67], [-1.79, 55.67], [-1.8, 55.67], [-1.79, 55.67], [-1.78, 55.68]]]]}"

How to use

Add your .geojson file to the /geojson folder. Then specify the name of the file as a command line argument when calling the script, e.g.:

python geojson_to_csv.py <name_of_file>

This will then convert the file to a GeoJSON CSV file and save to the /csv folder.

using BigQuery to convert to GEOGRAPHY

Once uploaded, you can then convert the GeoJSON field to GEOGRAPHY using:

select *,
ST_GEOGFROMGEOJSON(geometry, make_valid => TRUE)
from `data.table`

About

A simple script for parsing geojson files and converting them to CSV files ready to upload to GCP BigQuery.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages