First of all, why?
The regulatory community in Maine uses and projects it’s data as UTM Zone 19. That’s fine, except that it can be painful to get that data into WGS84, which seems to be far and away the preferred format for mapping applications on the web. The process I’m describing is certainly not beautiful, but so far it’s the best I’ve come up with. If you have any suggestions, email me please!
We’ll be using 2 tools to get this done. The first, gdaltransform is a part of… GDAL! Install that however is best for your OS. The second, csv2geojson is a nice way to transform csvs to, you guessed it, geojson. Install it with npm install -g csv2geojson
.
gdaltransform
.gdaltransform -s_srs EPSG:26919 -t_srs EPSG:4326 <initial.txt> converted.txt
will convert a list of coordinates projected in UTM Zone 19 to long, lats in WGS84.:%s/.\{2}$//
, and convert spaces to comma’s with :%s/ /,
.csv2geojson converted.csv > converted.geojson
will process your csv (projected in WGS 84 with appropriate headers) to a beautiful little GeoJSON which you can push to Github, load into Leaflet, or whatever else you think is fancy.Before you tell me this would be easier in ArcMap or whatever gui solution you typically use, yes, it might be for a one off conversion. But I’d rather stay out of gui’s, click less, and automate more. Keeping it cli helps me do that :)