Select to view content in your preferred language

how do you create the service that a flex Query accesses?

604
4
10-26-2010 11:41 AM
JasonThiel
New Contributor
Please bear with me, I'm new and trying to get my head around all of this.

I'm looking at the ArcGis api for flex concept "Using Query".  It all makes sense.  But, where did the query task, ESRI_StatesCitiesRivers_USA, come from?

Did somebody create a "layer" using ArcGIS Desktop and then deploy it to the server?  If that is the case, is this a query layer that has a definition query that gets seeded by the Query's text attribute?

I guess i'm not seeing the correlation between consuming services using Flex and creating those services using ArcGis Desktop application.

My approach to getting started is to try and define my "layers" using ArcGis Desktop.  Then I plan to deploy these to the ArcGis Server and only then will I start writing flex code to access display them.  Tentative plan is to use the flex viewer 2.1 as a base and add what I need.  I'm somewhat suprised the flex viewer doesn't have some kind of widget to turn various simple layers on/off like you see in google earth (checkboxes to turn off "attractions" etc).  Seems that would be a common thing to do.

thanks in advance for any answers and/or advice!
Tags (2)
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
Jason,

   Hope I can clear things up for you. You do begin in ArcMap by creating a ArcMap project (MXD) that you will optimize and then publish to ArcGIS Server. In ArcMap you will use the Map Service Publishing toolbar for the optimization. It is recommended that you publish as an MSD which is a optimized MXD. So a Map service that you publish can have multiple layers and data from multiple locations. Once you publish a Map Service you get REST Endpoints that will allow you to query and display the Map service in Flex.
0 Kudos
JasonThiel
New Contributor
That seems consistent with what I was thinking.  Looking closer.  Suppose my map contains a layer of gas stations.  Furthermore, the layer is a query layer defined by "Select * from gas_stations".  Additionally, the layer was defined with a "Definition Query" that effectively adds the where clause "where status = 'open'". 

so, when my flex app opens this layer with no criteria, it gets all gas stations that are open.  If i give criteria to the layer in my flex app, like "name = 'Exxon'", I would then get all Exxon stations that are open correct?  What I am getting at here is that criteria passed to the layer are added to any where already existing on the layer already.  Is that correct?

Thanks Again!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Jason,

   I have never tried to use a query layer with a layer definition and publish that to a map service. All I can suggest is give it a try.
0 Kudos
TracySchloss
Frequent Contributor
I have successfully used a definition query on my map service for a couple of projects and haven't been having any problems.  Basically it filters out the data before it ever gets to the service.
0 Kudos