Add a new SRS to GST

For this example we will add a new SRS to GST. The example SRS is ETRS89 / UTM zone 34N (EPSG:25834). The data is taken from http://epsg.io/25834.

Creating / Adding a new SRS in GST needs two steps.

Creating the SRS

First we need to create the SRS we want to add to GST. We can do this with one of three methods. Using either a proj.4 parameter, an OGC WKT parameter or an ESRI WKT paramter.

From a proj.4 parameter

param = "+proj=utm +zone=34 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

srs = GSTPy.SRS.from_proj4(param)

From an OGC WKT parameter

param = 'PROJCS["ETRS89 / UTM zone 34N",GEOGCS["ETRS89",DATUM["European_Terrestrial_Reference_System_1989",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6258"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4258"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",21],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","25834"]]'

srs = GSTPy.SRS.from_ogc_wkt(param)

From an ESRI WKT parameter

param = 'PROJCS["ETRS89_UTM_zone_34N",GEOGCS["GCS_ETRS_1989",DATUM["D_ETRS_1989",SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",21],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]'

srs = GSTPy.SRS.from_esri_wkt(param)

Adding the SRS to GST

Now we add the SRS to GST.

For this we need three additional parameters.

label

This can be any text, but is recommended to use the name of the SRS given by the EPSG entry. In our example this is “ETRS89 / UTM zone 34N”.

label = "ETRS89 / UTM zone 34N"

code_type

This should always be “EPSG”. Using something else might cause issues with GST Web. Since you need to provide the same information within the Javascript library proj4js.

code_type = "EPSG"

code_value

Use the code / number of the EPSG entry here. In our example this is “25834”.

code_value = "25834"

create_srs

Finally we add the new SRS in GST.

ni.create_srs(srs, label, code_type, code_value)

Full code sample for the proj.4 case

import GSTPy

param = "+proj=utm +zone=34 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

srs = GSTPy.SRS.from_proj4(param)

label = "ETRS89 / UTM zone 34N"

code_type = "EPSG"

code_value = "25834"

# assumes we have a connection already
ni.create_srs(srs, label, code_type, code_value)