Select to view content in your preferred language

Different results from different servers using the same JavaScript code?

3890
13
Jump to solution
01-09-2016 04:31 PM
DotMatrix
Deactivated User

I've ran into an issue while making a web app that I cannot figure out. The app allows a user to click on a feature, and edit its attributes using the AttributeInspector. Simple as that. I have a side panel with a div inside <div id="attributes"></div> where the AttributeInspector is created when a feature is selected.

The problem is that the code works fine on my development server, but not on our production server. And I have no idea why. It's the exact same code.

On the production server, when I click on a feature in the map, the AttributeInspector message says "No features selected" in the side panel. But on my development server it actually creates the AttributeInspector and shows the attributes and allows for editing.

When I look at the Network tab on the Chrome developer tools, I can see a successful query and it returns the feature I click on, but for whatever reason it doesn't show the attributes. However, on my development machine it works just fine.

The only difference is that the development machine is running ArcGIS Server 10.31, and our production server is running 10.3.

Any idea what could be wrong? I'm absolutely stumped. I don't know what could be causing the production server to not show the selected features.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Dot Matrix,

  You are using distance as part of the query. The 3.15 API docs say:

Distance to buffer input geometry. Query results will include features within the distance specified of the query.geometry. Valid only for hosted features services on arcgis.com. Optional. (Added at v3.9)

Which I believe this incorrect, but when I use my 10.3.1 ArcGIS Server and choose a Map Server and look at the rest end point distance is NOT an option on the query capability. But when I use a Feature Server distance is an option on the query capability. You need to check your code and make sure you are using feature server and not map server when switching to your production server urls.

service.jpg

View solution in original post

13 Replies
RobertScheitlin__GISP
MVP Emeritus

G G,

   A couple of questions.

  1. When you move this to your production sever are you using a proxy url that is accessible to the production server?
  2. Does the proxy have a server rule setup for your production server?
  3. Do you change the device url to something there production server has access to?

An observation is that FeatureLayer.MODE_AUTO has this note:

Delegate to either on-demand or snapshot mode depending on the characteristics of the service. This is only applicable to hosted feature services.
DotMatrix
Deactivated User

Hi Robert-

1) The production server also has it's own proxy, so I update the URL to point to it.

2) Yes, it does.

3) The device URL now resides on the actual production server.

The feature service and proxy URLs were both updated in the code to use the ones that reside on the production server. Wouldn't there be some error in the console if it were a proxy issue?

I got rid of the FeatureLayer.MODE_AUTO, and still doesn't work correctly.

--------

The data is in a State Plane (feet) coordinate system. And I'm using an ESRI basemap. So, the map is in Web Mercator, but my data is in State Plane.

On the production server, I edited the code to remove the ESRI basemap and do my own custom Extent with the spatial reference of my data.

This kind of works, but I have to zoom in reallllly close to the feature even though my query is saying within 75 feet of my mouse click (and I've changed this to 2000 feet, and I still have to zoom in reallllly close). So, something is not right. But at least I did see the attributes.

The strange thing is that this all works fine on my development machine. I'm using an ESRI basemap and my data is in the State Plane coordinate system. And it all works fine.

I have no idea what's going on, and why they are behaving differently.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Dot Matrix,

   Can you tell me if there are any errors in your browsers web console?

0 Kudos
DotMatrix
Deactivated User

There are no errors in the console.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Dot Matrix,

   Can you provide the urls for the public endpoint so I can do some testing then?

0 Kudos
DotMatrix
Deactivated User

Sorry, it's internal only.

0 Kudos
DotMatrix
Deactivated User

The strange thing is that I can see the responses, and I'm getting results back. But it's like it's not actually selecting the feature.

I wonder if it's some type of permission on the server that's being missed?

I created the feature service with a database connection using Windows/OS authentication. The ArcGIS Server Account has a login for the SQL Server instance, and it has a user and schema with read/write access.

Why wouldn't the features be selected even though it's returning a successful query?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Dot Matrix,

  You are using distance as part of the query. The 3.15 API docs say:

Distance to buffer input geometry. Query results will include features within the distance specified of the query.geometry. Valid only for hosted features services on arcgis.com. Optional. (Added at v3.9)

Which I believe this incorrect, but when I use my 10.3.1 ArcGIS Server and choose a Map Server and look at the rest end point distance is NOT an option on the query capability. But when I use a Feature Server distance is an option on the query capability. You need to check your code and make sure you are using feature server and not map server when switching to your production server urls.

service.jpg

DotMatrix
Deactivated User

Well that is interesting.

I'm definitely using a hosted feature service (in the sense that I'm hosting it) as shown in the URL in the code above:

"http://localhost:6080/arcgis/rest/services/data/device/FeatureServer/0"

But when I go into the Query screen of the rest endpoint for the feature service, it doesn't show Distance or Unit. This is the production server that is on 10.3.

If you look at the Sample code provided by ESRI:

Using the attribute inspector | ArcGIS API for JavaScript

The use this feature service:

http://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/NCAA_Tourney_2015/FeatureServer/1

And there server is running 10.3 also:

http://services.arcgis.com/V6ZHFr6zdgNZuVG0/ArcGIS/rest/services

But are they using data that is hosted from ArcGIS Online?

I still find it strange that my query is working though, and returning features - however, they just aren't being selected.

0 Kudos