Projection: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(explain the need of enough vertices for vector map reprojection (with screenshots))
m (commands added)
Line 21: Line 21:


Example: Box (polygon) created with {{cmd|v.in.region}}:
Example: Box (polygon) created with {{cmd|v.in.region}}:
g.region n=60 s=40 w=0 e=30 res=10 -p
v.in.region box_latlong_10deg


[[Image:V proj input unsplit boundaries.png|300px|center|thumb|4 corner rectangle, LatLong (no further vertices)]]<br>
[[Image:V proj input unsplit boundaries.png|300px|center|thumb|4 corner rectangle, LatLong (no further vertices)]]<br>


  v.split -n box output=box_w_vertices length=200 units=kilometers
  v.split -n box_latlong_10deg output=box_latlong_10deg_vertices_200km length=200 units=kilometers
 
[[File:V proj input split boundaries.png|300px|center|thumb|Split rectangle, LatLong]]<br>
[[File:V proj input split boundaries.png|300px|center|thumb|Split rectangle, LatLong]]<br>


As obvious from the results, enough vertices must be present in the map to avoid (severe) distortion. Note that this applies likewise to "ogr2ogr" and QGIS:
As obvious from the results, enough vertices must be present in the map to avoid (severe) distortion. Note that this applies likewise to "ogr2ogr" and QGIS:
# Test in OGR/QGIS
v.out.ogr box_latlong_10deg dsn=box_latlong_10deg.shp
ogr2ogr -t_srs epsg:3035 box_latlong_10deg_EU_LAEA.shp box_latlong_10deg.shp
qgis box_latlong_10deg_EU_LAEA.shp
# ... ops.
# Properly reproject in GRASS GIS (when having used v.split):
grass70 -c box_latlong_10deg_EU_LAEA.shp ~/grassdata/eulaea
v.proj box_latlong_10deg location=latlong_wgs84 mapset=neteler
v.proj box_latlong_10deg_vertices_200km location=latlong_wgs84 mapset=neteler
[[File:V proj result.png|300px|center|thumb|Results in EU LAEA (EPSG: 3035)]]<br>
[[File:V proj result.png|300px|center|thumb|Results in EU LAEA (EPSG: 3035)]]<br>



Revision as of 23:27, 10 May 2014

Projections and Datum Transformations

Brief introduction to projections and spatial transformations in GRASS

A GRASS location is referenced with a single projection and coordinate system (or unreferenced as XY location). When creating a new location from an existing raster or vector map using the tools available from the startup screen or the map import commands, projection and coordinate system are defined. To change the projection of maps, a new location has to be created and the desired maps have to be reprojected into it from the source location as explained below.

Read on in projectionintro...

Creation of a GRASS location

Support Material

  • Ready to use .PRJ files (in the usual WKT format) as used by recent versions of ESRI ArcView: download

Important: have enough vertices in your vector data

When reprojecting vector data, it is important to have enough vertices in the data.

Example: Box (polygon) created with v.in.region:

g.region n=60 s=40 w=0 e=30 res=10 -p
v.in.region box_latlong_10deg
4 corner rectangle, LatLong (no further vertices)


v.split -n box_latlong_10deg output=box_latlong_10deg_vertices_200km length=200 units=kilometers
Split rectangle, LatLong


As obvious from the results, enough vertices must be present in the map to avoid (severe) distortion. Note that this applies likewise to "ogr2ogr" and QGIS:

# Test in OGR/QGIS
v.out.ogr box_latlong_10deg dsn=box_latlong_10deg.shp
ogr2ogr -t_srs epsg:3035 box_latlong_10deg_EU_LAEA.shp box_latlong_10deg.shp
qgis box_latlong_10deg_EU_LAEA.shp
# ... ops.
# Properly reproject in GRASS GIS (when having used v.split):
grass70 -c box_latlong_10deg_EU_LAEA.shp ~/grassdata/eulaea
v.proj box_latlong_10deg location=latlong_wgs84 mapset=neteler
v.proj box_latlong_10deg_vertices_200km location=latlong_wgs84 mapset=neteler
Results in EU LAEA (EPSG: 3035)


See also

Google Map Projection