Ajouter un graphique

Un graphique est une représentation vectorielle de phénomènes géographiques du monde réel. Il peut contenir une géométrie et un symbole. Ajoutez un graphique à ArcGIS Earth et renvoyez l'ID du graphique et ses informations.

URL de la requête

<baseUrl>/arcgisearth/graphics(POST only)

Paramètres de requête

ParamètreDescription

ID

(facultatif)

Spécifie l'ID d'un graphique.

Type : chaîne

geometry

(obligatoire)

Position et type de géométrie d’un graphique. Définit les formats JSON des objets géométrie et référence spatiale. Prend en charge la géométrie de type point, polyligne et polygone.

Paramètres de point :

  • type
    • Type de géométrie.
    • Valeurs possibles : « point »
    • Type : chaîne
  • x
    • Coordonnée X mesurée le long de l’axe est-ouest.
    • Type : double
  • y
    • Coordonnée Y mesurée le long de l’axe nord-sud.
    • Type : double
  • latitude
    • Latitude du point.
    • Type : double
  • longitude
    • Longitude du point.
    • Type : double
  • spatialReference
    • Vous pouvez définir la référence spatiale à l’aide d’un ID bien connu (WKID). Pour obtenir une liste de valeurs WKID valides, reportez-vous à la rubrique Coordinate systems and transformations.
    • Type : chaîne

Syntaxe JSON :

{ 
    "type": <type>, 
    "x": <x>, 
    "y": <y>, 
    "spatialReference": { 
        <spatialReference> 
    } 
}

Paramètres de polyligne :

  • type
    • Type de géométrie.
    • Valeurs possibles : « polyline »
    • Type : chaîne
  • paths
    • Matrice de chemins, ou segments linéaires, constituant une polyligne. Uniquement pour la géométrie de type polyligne.
    • Type : number[][][]
  • spatialReference
    • Vous pouvez définir la référence spatiale à l’aide d’un ID bien connu (WKID). Pour obtenir une liste de valeurs WKID valides, reportez-vous à la rubrique Coordinate systems and transformations.
    • Type : chaîne

Syntaxe JSON :

{ 
    "type":<type>, 
    "paths": [
           [<x11>, <y11>, <z11>],
        ...,
        [<x1N>,<y1N>, <z1N>]
    ],  
    "spatialReference":{ 
            <spatialReference> 
      } 
}

Paramètres de polygone :

  • type
    • Type de géométrie. Le premier sommet de chaque anneau doit toujours être identique au dernier sommet.
    • Valeurs possibles : « polygon »
    • Type : chaîne
  • rings
    • Matrice d’anneaux.
    • Type : number[][][]
  • spatialReference
    • Vous pouvez définir la référence spatiale à l’aide d’un ID bien connu (WKID). Pour obtenir une liste de valeurs WKID valides, reportez-vous à la rubrique Coordinate systems and transformations.
    • Type : chaîne

Syntaxe JSON :

{ 
    "type":<type>, 
       "rings": [ 
            [<x11>, <y11>, <z11>], 
            …,
            [<x1N>, <y1N>, <z1N>] 
         ], 
     "spatialReference":{
        <spatialReference> 
    } 
}

symbol

(facultatif)

Symbole du graphique. Le choix du symbole d’un graphique dépend du type de géométrie du graphique.

Type : double

  • type
    • Type de symbole.
    • Valeurs possibles : « picture-marker »| « simple-line »| « simple-fill »
    • Type : chaîne
  • url
    • Spécifie l’URL ou le chemin d’un PictureMarkerSymbol. Uniquement pour PictureMarkerSymbol.
    • Type : chaîne
  • width
    • Largeur du symbole de ligne.
    • Type : nombre
  • height
    • Hauteur du symbole dans les points. Uniquement pour PictureMarkerSymbol.
    • Type : nombre
  • angle
    • Angle du repère par rapport à l’écran en degrés. Uniquement pour PictureMarkerSymbol.
    • Type : nombre
  • xoffset
    • Décalage sur l’axe x en points. Uniquement pour PictureMarkerSymbol.
    • Type : nombre
  • color
    • Couleur du symbole.
    • Type : couleur
  • outline
    • Contour du polygone.
    • Type : SimplelineSymbol

Exemple d’utilisation

Vous trouverez ci-après un exemple de résultat de l'ajout d’un graphique ponctuel :

{
  "id": " 4b75ea4a-e10f-d676-307d-aa945e2a0719", 
  "geometry": { 
		   "type": "polygon", 
     "rings": [[ 
			       [-96.06138,32.837], 
	       		[-97.06133,34.836], 
	       		[-98.06124,34.834], 
	       		[-97.06127,32.832], 
	       		[-97.06138,32.837] 
		]], 
	   	"spatialReference": {"wkid": 4326}
 }, 
			"symbol": { 	
   			"type": "simple-fill", 
			   "color": [76,115,0,255], 
			   "outline":{ 
	     			"color": [110,110,110,255], 
				     "width": 1 
	   		} 
   } 
}

Vous trouverez ci-après un exemple de résultat de l'ajout d’un graphique linéaire :

{
  "id": "polyline-simple-line-graphic",
  "geometry": {
         "type": "polyline",
         "paths": [
             [
                -118,
                34
              ],
             [
                -100,
                40
              ],
             [
                -82,
                34
              ]
          ]
       },
        "symbol": {
           "type": "simple-line",
           "color": "#33cc33",
           "width": "2px"
        }
 }

Voici un exemple d’entrée pour ajouter un graphique surfacique :

{
  "id": " 4b75ea4a-e10f-d676-307d-aa945e2a0719", 
  "geometry": { 
					"type": "polygon", 
                 "rings": [ 
					   [ 
					     [-96.06138,32.837], 
						 [-97.06133,34.836], 
						 [-98.06124,34.834], 
						 [-97.06127,32.832], 
						 [-97.06138,32.837] 
					   ] 
					 ], 
		"spatialReference": {"wkid": 4326} 
            }, 
            "symbol": { 
                "type": "simple-fill", 
                "color": [76,115,0,255], 
                "outline": 
					 { 
						 "color": [110,110,110,255], 
						 "width": 1 
				     } 
            } 
}

Exemple de réponse JSON

Voici un exemple de réponse JSON pour l’ajout d’un graphique ponctuel :

{
    "id": "point-picture-marker-graphic",
    "geometry": {
        "x": -100,
        "y": 40,
        "type": "point"
    },
    "symbol": {
        "angle": 0,
        "height": 48,
        "type": "picture-marker",
        "url": "https://static.arcgis.com/images/Symbols/Shapes/BlackStarLargeB.png",
        "width": 48,
        "xoffset": 7.5,
        "yoffset": 7.5
    }
}

Voici un exemple de réponse JSON pour l’ajout d’un graphique linéaire :

{
    "id": "polyline-simple-line-graphic",
    "geometry": {
        "paths": [
            [
                [
                    -118,
                    34
                ],
                [
                    -100,
                    40
                ],
                [
                    -82,
                    34
                ]
            ]
        ],
        "type": "polyline"
    },
    "symbol": {
        "color": [
            51,
            204,
            51,
            255
        ],
        "type": "simple-line",
        "width": 1.5
    }
}

Voici un exemple de réponse JSON pour l’ajout d’un graphique surfacique :

{
   "id": " 4b75ea4a-e10f-d676-307d-aa945e2a0719", 
   "geometry": { 
        "rings": [ 
            [ 
                [ 
                    -96.06138, 
                    32.837 
                ], 
                [ 
                    -97.06133, 
                    34.836 
                ], 
                [ 
                    -98.06124, 
                    34.834 
                ], 
                [ 
                    -97.06127, 
                    32.832 
                ], 
                [ 
                    -97.06138, 
                    32.837 
                ], 
                [ 
                    -96.06138, 
                    32.837 
                ] 
            ] 
        ], 
        "spatialReference": { 
            "wkid": 4326 
        }, 
        "type": "polygon" 
    }, 
    "symbol": { 
        "color": [ 
            76, 
            115, 
            0, 
            255 
        ], 
        "outline": { 
            "color": [ 
                110, 
                110, 
                110, 
                255 
            ], 
            "width": 1 
        }, 
        "type": "simple-fill",  
        "width": 1.5 
    } 

}