jQuery/User Search Questions

382
3
05-15-2020 05:12 PM
RobertSmith
New Contributor

For reference, this is the data I want to access: Airports 

I am looking to pull only certain parts of the data available from that reference based on what a user searches for. In particular, the airport name, code, and latitude/longitude. I want to then display that information on a Google map, not an ArcGIS map.

I have spent this week assuming I could do that via jQuery/AJAX, but I am beginning to think I have a misunderstanding of what AJAX is meant for. An example would be a user types in "LAX" and the returned result plots a location on a Google map and then displays the airport information available, such as address, phone number, etc.

Based on that, I have some questions:

1.) Can I use jQuery/AJAX to achieve what I want to do?

2.) If yes, how do you query that data set? There are two types of files (GeoService and GeoJSON)

3.) The code I have thus far, and I'll post it if I'm at least on the right track, continually returns all of a particular data field, such as all airport codes. It's not limiting it to only what the user searched for. And this is on a locally hosted JSON file, not the ArcGIS server.

Thank you for your help.

Tags (1)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Robert,

   I would recommend using the JS API and use the service url.

https://services6.arcgis.com/ssFJjBXIUyZDrSYZ/arcgis/rest/services/US_Airport/FeatureServer/0

You can use a QueryTask to query the data you want and you can add the graphics returned to a GraphicsLayer to add to the map.

There is no need to add 3rd party library like jQuery when this can all be done in the esri JS API.

RobertSmith
New Contributor

Thank you for the reply. I did some looking into this and this may be an option for a starting point. Am I able to retrieve specific data and display it outside of the map and just onto a table or a website? Some of the information I need doesn't need to be on the map, while the rest can.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Robert,

Am I able to retrieve specific data and display it outside of the map and just onto a table or a website?

Sure the Query class returnGeometry property can be set to false if you do not need the spatial portion and only need the data attributes