Geometry Objects in JSON


The geometry objects in SuperMap iServer are represented by id, parts, style and type, etc. Among them,

Below is the introduction for the construction of the simple point, line object, and region objects.

1. Simple point object

For a simple point object, parts is an integer array at the length of 1, and the value of the single element in the array is 1. The value of type is POINT.

Below is a simple point object in JSON format:

{

    "id": 1,

    "parts": [1],

    "points": [{

        "x": 25.27596664428711,

        "y": 54.688568115234375

    }],

    "style": null,

    "type": "POINT"

}

2. Simple line object

A line object is consisted of a set of points. The value of type is LINE.

Below is a simple line object in JSON format:

{

    "id": 1,

    "parts": [4],

    "points": [{

        "x": 96.37172516065249,

        "y": 399.73448202810533

    },

    {

        "x": 127.60869053503754,

        "y": 290.4051032177577

    },

    {

        "x": 397.3824824047266,

        "y": 362.8180684038321

    },

    {

        "x": 357.05839983052044,

        "y": 279.0462067179813

    }],

    "style": null,

    "type": "LINE"

}

3. Simple region object

A region object is consisted of a set of points, with the starting and ending points coincide.

Below is a simple region object in JSON format:

{

    "id": 1,

    "parts": [4],

    "points": [{

        "x": -12.908614415006994,

        "y": 407.37026387547877

    },

    {

        "x": -2.916359855276923,

        "y": 248.49341637577055

    },

    {

        "x": 250.22075565788498,

        "y": 305.782342518223

    },

    {

        "x": 185.2711010196395,

        "y": 413.3656166113168

    },

    {

        "x": -12.908614415006994,

        "y": 407.37026387547877

    }],

    "style": null,

    "type": "REGION"

}