AnsweredAssumed Answered

Geo-fencing in Quick Report App

Question asked by kjerath_hanovercounty on Aug 14, 2017
Latest reply on Aug 16, 2017 by kjerath_hanovercounty

I'm trying to limit the Quick Report app so that points can only be collected if they are within a certain geographic area.

 

I have defined my limiting polygon within the mapView:

            ServiceFeatureTable {
                id: countyBoundary
                url: "https://hangis.hanoverva.gov/arcgis/rest/services/county_boundary/MapServer"
            }

I added a geometry check within the nextPage function so it will not allow the user to proceed if the point is not within the polygon:

    function nextPage(){
        positionSource.active = false;
        app.theNewPoint = mapView.currentViewpointCenter.center;

        var withinCounty = GeometryEngine.within(app.theNewPoint, countyBoundary)
        console.log("withinCounty", withinCounty)

        if(withinCounty === true) {
            next("");
        }
        else {
            invalidGeometryAlertBox.text = qsTr("Invalid geometry. Point not within Hanover County.")
            invalidGeometryAlertBox.visible = true;
        }
    }

The problem is I keep getting false for withinCounty, even when the point is within the county boundary.

Outcomes