I am drawing an object on map and retrieving it's geometry using following code:

this.draw = new SketchViewModel({
    layer: this.drawLayer,
    view: this.view

this.draw.on("create", function(event: SketchViewModelCreateEvent) {
    if (event.state === "complete") {
        const geometry = event.graphic.geometry;

Now i would like to store this geometry directly into esri sde database (postgres) using backend web application. This geometry is in esri json format. I can transform it into geojson format but still I cannot find any function that can save such geometry (esri json, geojson) directly into sde_geometry column. There are however methods to save geometry from WKT format.

So my question is: how can I convert graphic geometry into WKT format? Or maybe is there a better way to achieve this?

1 Answer 1


You can use arcgis-to-geojson-utils library (see https://github.com/Esri/arcgis-to-geojson-utils) to convert ESRI JSON to GeoJSON, and then terraformer/wkt library (see https://github.com/terraformer-js/terraformer/blob/main/packages/wkt/README.md) to convert GeoJSON geometry to WKT format.

Conversion code could then look something like this:

var geoJSON = ArcgisToGeojsonUtils.arcgisToGeoJSON(esriFeature.toJSON());
var wkt = Terraformer.geojsonToWKT(geoJSON.geometry);
  • It's a pity there is no native support to such conversion in esri sdk. Your solution with Terraformer works. Thanks.
    – gisit
    Mar 23, 2023 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.