Select to view content in your preferred language

Map and Symbology not displaying - previously working fine

685
7
Jump to solution
11-22-2023 07:17 AM
luckachi
Occasional Contributor III

I have a web map displayed on our website that performs queries and returns the results as graphics on the map. Currently, when you first go to the website, the map and all of the different sections load and display fine. However, as soon as you select an option in our "Search by" widget, the map goes blank and nothing is displayed. The queries are working fine because the data that should be shown on the map is showing up in the dgrid just below the map. If you select a record from the table below, it will zoom to the correct location and the map loads, but the symbology for the feature does not. We were running 4.24 with a dgrid (4.17) and I thought that may have been the issue so I changed it to 4.28 but that did not corrected the problem - it only threw a ton of dojo errors. Nothing else in the code had changed in quite a few months. Nothing is returned in the console, so I am not quite sure what is going on?

Any suggestions or help? 

Map can be found here: https://www.misin.msu.edu/mapviewer/

current setup:

    <link rel="stylesheet" href="https://js.arcgis.com/4.24/esri/themes/light/main.css">
    <script src="https://js.arcgis.com/4.24/"></script>

    <script type="module" src="https://unpkg.com/@esri/calcite-components@1.0.0-next.280/dist/calcite/calcite.esm.js"></script>
    <link rel="stylesheet" type="text/css" href="https://unpkg.com/@esri/calcite-components@1.0.0-next.280/dist/calcite/calcite.css">

    <link rel="stylesheet" href="https://js.arcgis.com/4.17/dgrid/css/dgrid.css">
1 Solution

Accepted Solutions
luckachi
Occasional Contributor III

@KenBuja Looks like it may be an issue with 10.8/10.9 

Stumbled upon this thread https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-features-for-featurelayer-r... 

and added the below lines of code and it seemed to fix it.. 

 

esriConfig.request.interceptors?.push({
        before(params) {
          if (params.url.includes("query")) {
            params.requestOptions.query.f = 'json';
          }
        }
      });

 

  

View solution in original post

0 Kudos
7 Replies
KenBuja
MVP Esteemed Contributor

It looks like you're having a spatial reference problem when making graphics from the query results. If you zoom out far enough, you'll see the records, but they're in a straight line. If you click the home button, the map shows up again.

map.png

Examining one of the points in the query results shows its latitude and longitude are kind of screwy.

point.png

0 Kudos
luckachi
Occasional Contributor III

Well that is bizarre as nothing in the code and changed and it was working fine a week or so ago. 🤔 

So I added the spatialReference to my view... and that didn't seem to change anything - it just made the initial map stop loading so I removed it. 

We did upgrade our server, where the data sits, from 10.7.1 to 10.9 yesterday so I thought maybe something was messed up there but I just re-published the service and nothing changed.

0 Kudos
KenBuja
MVP Esteemed Contributor

It looks like "-8" is getting added to the beginning of the latitude of each point. When I examine one of the points in the response, its latitude attribute is "46.53949113" while the geometry latitude is "-846.5394911299999". I can't figure out where that is happening, since looking at the same point from the rest service shows the correct values.

rest.png

response.png

And you're getting lots of dojo errors when you used v4.28 since dojo has been been almost fully removed from the SKD

0 Kudos
luckachi
Occasional Contributor III

How bizarre. I will try and mess around with it some more to see if I can figure out what is going on. Seems strange that it would just randomly start doing this.

Yes, that is unfortunately why we have remained at 4.24 for this map. At some point we will need to find another solution so we can use the latest version.

 

I double checked both feature services and both have a spatial reference of 4326. 😕

0 Kudos
luckachi
Occasional Contributor III

@KenBuja Looks like it may be an issue with 10.8/10.9 

Stumbled upon this thread https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-features-for-featurelayer-r... 

and added the below lines of code and it seemed to fix it.. 

 

esriConfig.request.interceptors?.push({
        before(params) {
          if (params.url.includes("query")) {
            params.requestOptions.query.f = 'json';
          }
        }
      });

 

  

0 Kudos
KenBuja
MVP Esteemed Contributor

Nice find!

KenBuja
MVP Esteemed Contributor

And you should click the Accept as Solution button in your response to help others if they have this problem.