Select to view content in your preferred language

Basemap Layer & QueryTask

3376
9
11-18-2011 09:23 AM
AliciaSoto
Frequent Contributor
Hello All,

When editing the JSON file, is it possible for the app to zoom into the result of a "queryTask" if no basemap has been assigned?

I noticed my "queryTasks" wouldn't work until I assigned a basemap in the JSON.

Thanks,
0 Kudos
9 Replies
AliciaSoto
Frequent Contributor
I've realized that the basemap might not be the issue.

Here are the JSON files for two different mobile apps. The scripts look identical, but are referring to different map services.

The first one will zoom in to a queryTask result, but the second one will only zoom in if you select another basemap(within the app).

This is the one that works
{
    "version" : "1.3",
    "operationalLayers" : [{
        "url" : "http://myserver/ArcGIS/rest/services/maps/iOS_Forum_Test/MapServer",
        "visibility" : true,
        "opacity" : 1,
        "title" : "GIS Layers"
    }],
    "tasks" : {
        "queryTasks" : [{
            "displayField" : "Find Congressional District",
            "name" : "Congressional District",
            "parameters" : [{
                "defaultValue" : "",
                "field" : "CD111FP",
                "helpTip" : "Enter # Here",
                "operator" : "=",
                "prompt" : "Find Congressional District by Number"
            }],
            "url" : "http://myserver/ArcGIS/rest/services/maps/iOS_Forum_Test/MapServer/1",
            "visibleFields" : ["CD111FP","GEOID10","NAMELSAD10","ALAND10"],
            "whereClause" : "{0}"
        }]
    }
}


This one does not work

{
    "version" : "1.3",
    "operationalLayers" : [{
        "url" : "http://myserver/ArcGIS/rest/services/maps/Mobile_AMR/MapServer",
        "visibility" : true,
        "opacity" : 1,
        "title" : "GIS Layers"
    }],
    "tasks" : {
        "queryTasks" : [{
            "displayField" : "DCU_NAME",
            "name" : "DCU Query",
            "parameters" : [{
                "defaultValue" : "",
                "field" : "DCU_NAME",
                "helpTip" : "Enter DCU Name Here",
                "operator" : "=",
                "prompt" : "DCU Query by Name"
            }],
            "url" : "http://myserver/ArcGIS/rest/services/maps/Mobile_AMR/MapServer/0",
            "visibleFields" : ["DCU_NAME","STATUS","DESCRIPTION","NAME"],
            "whereClause" : "{0}"
        }]
    }
}
0 Kudos
AliciaSoto
Frequent Contributor
Strangely, the 2nd code I posted above will only work if I add an ESRI online basemap. Maybe the zoom to query result is affected by the coordinate system of my operational layer.....
0 Kudos
RussRoberts
Esri Notable Contributor
Are you using any basemap layers within your project?
Thanks
Russ
0 Kudos
AliciaSoto
Frequent Contributor
Are you using any basemap layers within your project?
Thanks
Russ


No. I do not have any basemap layer assigned for either of the 2 codes posted above. That's why I'm confused on why one works and the other doesn't.

Thanks
0 Kudos
RussRoberts
Esri Notable Contributor
What projections are they in? and are you viewing this is the latest version of the iOS app?
Thanks
Russ
0 Kudos
AliciaSoto
Frequent Contributor
The iOS app is up to date.

The coordinate system for the one that works is:
GCS_North_American_1983
Datum: D_North_American_1983


and the one that doesn't work is:

NAD_1983_StatePlane_Texas_South_FIPS_4205_Feet
Projection: Lambert_Conformal_Conic
False_Easting: 984250.000000
False_Northing: 16404166.666667
Central_Meridian: -98.500000
Standard_Parallel_1: 26.166667
Standard_Parallel_2: 27.833333
Latitude_Of_Origin: 25.666667
Linear Unit: Foot_US

GCS_North_American_1983
Datum: D_North_American_1983
0 Kudos
RussRoberts
Esri Notable Contributor
I just tried out a couple services.. one in web Mercator and one using  the NAD83 / UTM zone 16N projection and the both zoomed to my results. I will try out a service with the same projections that you used for sample code #2.


Russ
0 Kudos
AliciaSoto
Frequent Contributor
I just tried out a couple services.. one in web Mercator and one using  the NAD83 / UTM zone 16N projection and the both zoomed to my results. I will try out a service with the same projections that you used for sample code #2.


Russ


Thank you!
0 Kudos
RussRoberts
Esri Notable Contributor
I am able to get it to zoom to the correct level on a map service using the NAD 83 State Plane for Texas South... If you want you can invite me to a group and I can check out the service there.
Cheers
Russ
0 Kudos