A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-symbolService.html below:

symbolService | API Reference | ArcGIS Maps SDK for JavaScript 4.33

ESM: import * as symbolService from "@arcgis/core/rest/symbolService.js";

CDN: const symbolService = await $arcgis.import("@arcgis/core/rest/symbolService.js");

Object: @arcgis/core/rest/symbolService

Since: ArcGIS Maps SDK for JavaScript 4.25

Represents symbol service resources exposed by the ArcGIS REST API. This module provides resources to convert Scalable Vector Graphics (SVG) to CIMSymbols.

Method Overview Method Details

Parameters

URL to the ArcGIS Server REST resource that represents a symbol service.

Input parameters for converting an SVG to CIM Symbol.

optional

Additional options to be used for the data request.

Returns

Type Description Promise<GenerateSymbolResponse> A promise that resolves with the response of the generate symbol method that contains the CIM Symbol.

Examples

// Using a string.
const svgString = `
   <svg xmlns="http://www.w3.org/2000/svg" height="200" width="200">
     <path d="M150 0 L75 200 L225 200 Z" />
   </svg>
`;
const params = { svgImage: svgString };
symbolService.generateSymbol(symbolServiceUrl, params).then({symbol} => {
  // apply the CIMSymbol to a graphic
  graphicA.symbol = symbol;
});
// Using FormData.
const blob = new Blob([svgSymbol.trim()], { type: "image/svg+xml" });
const formData = new FormData();
formData.append("svgImage", blob, "symbol.svg");

const params = { svgImage: formData };
symbolService.generateSymbol(symbolServiceUrl, params).then({symbol} => {
  // apply the CIMSymbol to a graphic
  graphicB.symbol = symbol;
});
// Using HTMLFormElement.
<!-- HTML Element -->
<form name="uploadForm">
  <input type="file" name="svgImage" id="svgFile" />
</form>
// JavaScript
const uploadForm = document.forms["uploadForm"];
uploadForm.addEventListener("change", (event) => {
    const fileName = event.target.value.toLowerCase();
    if (fileName.includes(".svg")) {
        const params = { svgImage: uploadForm };
        symbolService.generateSymbol(symbolServiceUrl, params).then({symbol} => {
           // apply the CIMSymbol to a graphic
           graphicC.symbol = symbol;
        });
    }
});
Type Definitions
GenerateSymbolParameters Type Definition GenerateSymbolParameters Object

Input parameters for the generateSymbol method.

Property
optional

The SVG image to convert. Can be an SVG string value, form data, or form element. When providing the SVG from FormData or HTMLFormElement, the name of the element in the form must be "svgImage". When providing the SVG from a string, the XML namespace (xmlns) must be defined.

GenerateSymbolResponse Type Definition GenerateSymbolResponse Object

The response of the generateSymbol method.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4