How to Connect Data to a Map

2018
25
Jump to solution
02-09-2017 09:31 AM
WilliamMiller4
Occasional Contributor II

Hi,

I have a map service that holds a non-geographic table from a non-ArcGIS database. I need to connect that data to the map, so the properties can be highlighted, etc. There are fields in the table that match data in the map, such as account_number. How do I match the two so I can get each properties' coordinates or am I going about this wrong?

William

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

William,

   If you followed Andrews advice in that other thread and registered the data with ArcGIS Server than you can join the non-spatial table and publish a new map service containing the joined data.

View solution in original post

25 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

William,

   If you followed Andrews advice in that other thread and registered the data with ArcGIS Server than you can join the non-spatial table and publish a new map service containing the joined data.

View solution in original post

WilliamMiller4
Occasional Contributor II

Hi Robert,

We registered a view of the joined tables with ArcGIS Server. (For some reason, ArcMap could join the tables but not publish them as a service.) So it's possible to join a non-spatial table with a map layer?

William

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Sure that is extremely common practice in ArcMap.

WilliamMiller4
Occasional Contributor II

Hi Robert,

Unfortunately this solution won't work as the view of the two tables has multiple records for each account number (one of the tables is of property sales) and ArcMap's join only adds one of the records. At least that's what I'm told will happen.

William

0 Kudos
WilliamMiller4
Occasional Contributor II

Hi Robert,

Since I'm using a WCF rest service, how should I go about getting query results that include a reference or link to a parcel? I found this article about Using QueryTask, Query, and FeatureSet that seems helpful for running a query like this from Web AppBuilder, but how would I do it from the WCF rest service?

William

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

William,

   I a little confused by this question. What does your rest service do then if it is not already querying a database?

In my parcel rest service I pass a parcel identification number to it from the results of a query task or a selection and then in the web service I query my CAMA data (non-gis data) using a SQL query with that ppin and pass back the CAMA data of interest for that parcel.

0 Kudos
WilliamMiller4
Occasional Contributor II

Hi Robert,

From my widget, I use esriRequest to pass user specified input (say a school district, a sale date range and a sale price range) to the my rest service. The rest service puts the request in SQL format, queries the database and returns information on the parcels that match, such as account number, address, sale date, sale price, seller, buyer, square footage, etc. I'm not sure how to query an ArcGIS rest service directly from my rest service to get the geometry or spatial references to link the database data to the map.

William

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

William,

  I would not try to have the rest service do that I would return that data and then back in the app use a QueryTask to get the graphic from ArcGIS Server using a query based on the account number or parcel number.

WilliamMiller4
Occasional Contributor II

Hi Robert,
I'm trying to get the graphic for each parcel returned from the rest service set to a variable, pass that variable as part of an object and add the graphic to the map, however I seem to be missing something, most likely related to dojo/Deferred. The code below seems to work, but if I uncomment line 33, I get "Reference Error: graphic is not defined". If I comment out line 20 and uncomment line 21, all the parcels are black, and the symbolColor, while correct in the console.log(line 9), has NaN for the RGB values in the console.info(line 22).

_requestSucceeded: function(response){
 
  for(var i = 0, len = response.length; i < len; i++){
   
    var accountNum = response[i].AccountNum;
    var include = response[i].Include;
    var symbolColor = response[i].SymbolColor;
    var def = new Deferred();
    console.log(symbolColor);
   
    //Get information on the shape of each parcel from the AccountNum
    var queryString = "AccountNum = " + response[i].AccountNum;
    var query = new Query();
    var queryTask = new QueryTask("arcgis/rest/services/Dynamic/AccountNumber/MapServer/0");
    query.where = queryString;
    query.returnGeometry = true;
    queryTask.execute(query, lang.hitch(this, function(results){
      var features = results.features;
      for(var i = 0, len = features.length; i < len; i++){
        var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0]), 2), new Color([255,255,0,0.25]));
        //var symbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([symbolColor]), 2), new Color([symbolColor,0.25]));
        console.info(symbol);
        var graphic = features[i];
        graphic.setSymbol(symbol);
        this.map.graphics.add(graphic);
      }
      def.resolve({state: 'success', value: results});
    }), lang.hitch(this, function(error){
      def.resolve({state: 'failure', value: error});
    }));
       
    this.list.add({
      //graphic: graphic,
      accountNum: accountNum,
      include: include,
      symbolColor: symbolColor
    });
  }
}

William

0 Kudos