AnsweredAssumed Answered

Graphic not showing at the right coordinates

Question asked by marco_piccolino on May 16, 2015
Latest reply on May 18, 2015 by marco_piccolino

Hi,

I am having trouble with the following code.

I would expect the Graphic to show up at the specified x and y, but instead it shows up at 0,0.

Am I missing anything?

 

---

 

import QtQuick 2.3

import QtQuick.Controls 1.2

import ArcGIS.Runtime 10.25

 

ApplicationWindow {

    id: appWindow

    width: 800

    height: 600

    title: "arcgis template"

 

    GraphicsLayer {

        id: graphicsLayer

    }

 

    Map {

        id: map

        anchors.fill: parent

        wrapAroundEnabled: true

        focus: true

        extent: aoi

        Envelope {

            id: aoi

            spatialReference: SpatialReference {

                wkid: 4326

            }

            xMin: 9

            yMin: 45

            xMax: 10

            yMax: 47

        }

 

        ArcGISLocalTiledLayer {

            path: "~/ArcGIS/Runtime/Data/tpks/Topographic.tpk"

        }

 

        onStatusChanged: {

            if(map.status === Enums.MapStatusReady) {

                graphicsLayer.renderingMode = Enums.RenderingModeStatic;

                addLayer(graphicsLayer);

                var graphic = {

                    geometry: {

                        spatialReference: {wkid:4326},

                        x: 9.5,

                        y: 46

                    },

                    symbol: {

                        type: "esriSMS",

                        size: 10,

                        color: "blue"

                    }

                };

                var id = graphicsLayer.addGraphic(graphic);

            }

        }

    }

}

Outcomes