Last active
August 29, 2015 14:17
-
-
Save amoeba/cb7913fd903cb1887a02 to your computer and use it in GitHub Desktop.
Steps to switch a 0-degree meridinal map to 180-degree meridinal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Note: These instructions assume the extent is -180 - 180, and -90 - 90. Use gdalinfo to check beforehand. They also assume our spatial file is longlat-projected. | |
| For raster: | |
| 1. Grab a raster file | |
| 2. Decide upon how we'd like to trim. Below, we trim to -180:-120x30:90 and then 120:180x30:90 | |
| 2. Trim: gdalwarp -te -180 30 -120 90 {SPATIAL_FILE_PATH} {OUTPUT_FILE_PATH} | |
| 3. Trim: gdalwarp -te 120 30 180 90 {SPATIAL_FILE_PATH} {OUTPUT_FILE_PATH} | |
| 4. Reproject: gdaltransform -s_srs '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' -t_srs '+proj=longlat +ellps=WGS84 +pm=360 +datum=WGS84 +no_defs' | |
| For vector: | |
| ogr2ogr -clipsrc -180 0 -100 90 ne_10m_coastline_right.shp ne_10m_coastline.shp | |
| ogr2ogr -clipsrc 100 0 180 90 ne_10m_coastline_left.shp ne_10m_coastline.shp | |
| ogr2ogr output.shp -t_srs "EPSG:4326" input.shp | |
| ogr2ogr merged.shp ne_10m_coastline_right.shp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment