zoom to a geometry

1617
1
Jump to solution
07-06-2016 03:23 AM
albavoli
New Contributor III

i want the map when first display to zoom to a specific point but it always zoom to the positionDisplay source so to my current position

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

Perhaps you need to turn auto panning off on your position display?

import QtQuick 2.3

import QtQuick.Controls 1.2

import QtPositioning 5.3

import ArcGIS.Runtime 10.26

ApplicationWindow {

    id: appWindow

    width: 800

    height: 600

    title: "s"

    Map {

        anchors.fill: parent

        focus: true

        ArcGISTiledMapServiceLayer {

            url: "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"

        }

        positionDisplay {

            positionSource: PositionSource {

                active: true

            }

            mode: Enums.AutoPanModeOff

        }

        onStatusChanged: {

            if (status === Enums.MapStatusReady) {

                zoomTo(usExtent);

            }

        }

    }

    Envelope {

        id: usExtent

        xMax: -15000000

        yMax: 2000000

        xMin: -7000000

        yMin: 8000000

        spatialReference: SpatialReference {

            wkid: 102100

        }

    }

}

View solution in original post

1 Reply
LucasDanzinger
Esri Frequent Contributor

Perhaps you need to turn auto panning off on your position display?

import QtQuick 2.3

import QtQuick.Controls 1.2

import QtPositioning 5.3

import ArcGIS.Runtime 10.26

ApplicationWindow {

    id: appWindow

    width: 800

    height: 600

    title: "s"

    Map {

        anchors.fill: parent

        focus: true

        ArcGISTiledMapServiceLayer {

            url: "http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"

        }

        positionDisplay {

            positionSource: PositionSource {

                active: true

            }

            mode: Enums.AutoPanModeOff

        }

        onStatusChanged: {

            if (status === Enums.MapStatusReady) {

                zoomTo(usExtent);

            }

        }

    }

    Envelope {

        id: usExtent

        xMax: -15000000

        yMax: 2000000

        xMin: -7000000

        yMin: 8000000

        spatialReference: SpatialReference {

            wkid: 102100

        }

    }

}

View solution in original post