coordtransfer


URI

<geometry_uri>/coordtransfer[.<format>]

Supported methods

GET, POST, HEAD

Parent resource

geometry

Introduction

coordtransfer resource represents projection coordinate system conversion resource. By executing a POST request on this resource, the system can convert the coordinate sytem of the specified points or geometries to another specified projection coordinate system.

Supported Methods:

Supported output formats: RJSON, JSON, HTML, XML.

Resource hierarchy

HTTP request methods

Execute HTTP request on the following URI, here we take rjosn as the output format as an example. Where, supermapiserver is the server name.

http://supermapiserver:8090/iserver/services/geometry/restjsr/v1/geometry/coordtransfer.rjson

GET request

Gets the form of the POST request.

POST request

Converts the coordinate system of the specified points or geometries to another specified projection coordinate system.

Request parameter

The following parameters should be contained in the request body:

Field Type Definition
sourcePoints Point2D[]

[sourcePoints or sourceGeometries is required.]

Source points, such as: [{"x":113.98533886568,"y":4.39179640504},{"x":112.98533886568,"y":3.39179640504}].

sourceGeometries Geometry[]

[sourcePoints or sourceGeometries is required.]

Source geometries, used when the geometries to be converted are lines or polygons. Here you can pass in different types of geometires, such as: [{"type":"LINE","points":[{"x": 113.98533886568,"y": 4.39179640504},{"x": 114.98533886568,"y": 5.39179640504}]},{"type":"LINE","points":[{"x": 115.98533886568,"y": 5.39179640504},{"x": 116.98533886568,"y": 6.39179640504}]}].

sourceEpsgCode

int

[sourceEpsgCode or sourcePrj is required.]

The EPSG Code, which corresponds to the coordinate sytem of the source points or geometries.

sourcePrj PrjCoordSys

[sourceEpsgCode or sourcePrj is required.]

The json description of the coordinate system of the source points or geometries. Used when the coordinate sytem of the source points or geometries don't have the corresponding EpsgCode.

targetPrj PrjCoordSys

[targetPrj or targetEpsgCode is required.]

Target coordinate system, to which the source points or geometries will be converted. Used when the target coordinate sytem doesn't have EpsgCode. And it needs to be constructed with fields of PrjCoordSys.

targetEpsgCode int

[targetPrj or targetEpsgCode is required.]

The cooresponding EPSG Code of the target coordinate system.

Response structure

By performing a GET request on coordtransfer resource, the response entity is a description set of the converted results, ie., Geometry[], and the description structure of one single result is as follows

Field Type Description
center Point2D[] The center of the geometry.
parts int[] The number of nodes in each child object of the geometry.
style Style The style of the geometry.
prjCoordSy PrjCoordSys The projected coordinate system of the geometry.
id int The unique identifier of the geometry.
pointTopo int[] The topological structure of part. Currently this field has a value only when GeometryType = REGION, where 1 represents island, -1 represents hole.
points Point2D[] The array of pairs of 2D coordinates of the nodes which make up the geometry.

Example

Perform a POST request on coordtransfer resource to transform the projected coordinate system of the input points with URI: http://supermapiserver:8090/iserver/services/geometry/restjsr/v1/geometry/coordtransfer.rjson

, which uses epsgcode to set the source coordinate system, and uses json format to set the target coordiante system. The parameters in request body are:

{

  "sourcePoints":[{"x":113.98533886568, "y":4.39179640504}, {"x":112.98533886568, "y":3.39179640504}],

  "sourceEpsgCode":4326,

  "targetPrj":

     {

       "distanceUnit":"METER",

       "projectionParam":

         {

            "centralParallel":0,

            "firstPointLongitude":0,

            "rectifiedAngle":0,

            "scaleFactor":1,

            "falseNorthing":0,

            "centralMeridian":0,

            "secondStandardParallel":0,

            "secondPointLongitude":0,

            "azimuth":0,

            "falseEasting":0,

            "firstStandardParallel":0

         },

       "epsgCode":3857,

       "coordUnit":"METER",

       "name":"User Define",

       "projection":

            {

                "name":"SPHERE_MERCATOR",

                "type":"PRJ_SPHERE_MERCATOR"

            },

        "type":"PCS_USER_DEFINED",

        "coordSystem":

               {

                   "datum":

                        {

                            "name":"D_WGS_1984",

                            "type":"DATUM_WGS_1984",

                            "spheroid":

                                {

                                     "flatten":0.00335281066474748,

                                     "name":"WGS_1984",

                                     "axis":6378137,

                                     "type":"SPHEROID_WGS_1984"

                                 }

                         } ,

                   "unit":"DEGREE",

                   "spatialRefType":"SPATIALREF_EARTH_LONGITUDE_LATITUDE",

                   "name":"GCS_WGS_1984",

                   "type":"GCS_WGS_1984",

                   "primeMeridian":

                        {

                           "longitudeValue":0,

                           "name":"Greenwich",

                           "type":"PRIMEMERIDIAN_GREENWICH"

                         }

                  }

      }

}

the returned result is as follows:

[

   {

    "center":

      {

        "x":1.2688789880426234E7,

        "y":489371.98562014854

      },

     "parts":[1],

     "style":null,

     "prjCoordSys":null,

     "id":0,

     "type":"POINT",

     "partTopo":null,

     "points":

       [

          {

            "x":1.2688789880426234E7,

            "y":489371.98562014854

           }

        ]

      },

     {

     "center":

       {

         "x":1.257747038963296E7,

         "y":377793.7702294255

       },

     "parts":[1],

     "style":null,

     "prjCoordSys":null,

     "id":0,

     "type":"POINT",

     "partTopo":null,

     "points":

         [

             {

                "x":1.257747038963296E7,

                "y":377793.7702294255

             }

         ]

     }

]

HEAD request

Returns the same HTTP response header as the GET request, but no response entity, which can be used to retrieve the meta data contained in response message header without having to transmit the entire response content. Meta data information includes media type, character coding, compression coding, entity content length, etc.

HEAD request is used to determine whether the coordtransfer resource exists, or if the client has the authority to access it. By executing an HEAD request with a .<format> URI, you can quickly determine whether the coordtransfer resource supports the <format> representation.

See