Sunday, 3 December 2017

gdal - Generating shapefile containing UTM grid (graticule)?


I'm looking for a shapefile containing an 1000m or 2000m UTM grid ("graticule"). All I was about to find on the web is a 10000m UTM grid (here: http://en.giswiki.net/wiki/UTM) and I am aware that a 1000m UTM grid for the whole world might be quite big.


That's why I'm now wondering if and how it would be possible to generate such a shapefile for a part of the world. I would prefer to use open source tools like gdal. Others output formats than a shapefile might be ok too.


Has anyone an idea?



Answer




Thanks to the other answers I was able to do it this way:




  1. Determine the wanted UTM coordinates.



    • UTM zone: determine the zone between 1 and 60 by looking at a map like here http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system

    • EPSG code for the UTM zone: on WGS84 it is EPSG:326xx, where xx is the number of the zone (see http://www.spatialreference.org/ref/?page=18&search=UTM+zone). In Europe some maps use ETRS89 instead of WGS84. There is also a corresponding EPSG code (EPSG:258xx) but the difference to WGS84 is too small to notice, so that you can as well use WGS84.

    • Easting: within a zone the easting coordinate is always greater than 100000m and smaller than 900000m, so I simply take 100000-900000 as limits for the easting value.

    • Northing: it's the distance to the equator, let's say I need a 1000km part between 5000000m and 6000000m.





  2. Use SAGA GIS as suggested by johanvdw. Start a new project, select MODULES-SHAPES/TOOLS > CREATE GRATICULE, enter the following values and click “Okay”:enter image description here


    (It might alternatively be possible to use QGIS as suggested by Darren Cope)




  3. Go to the tab “Data”, right click on the graticule in the tree and choose “Save as” to create a shapefile. Let's say “UTM_without_CS.shp”.




  4. Use ogr2ogr to attribute a coordinate system. Let's say you want UTM zone 30 on WGS 84 (= EPSG:32630):



    ogr2ogr -a_srs EPSG:32630 UTM.shp UTM_without_CS.shp




That's it!


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...