Get started with the ArcGIS world Geocoding service
Hello everyone,
My name is Changlin and I am a second year masters student from Geomatics Engineering at the University of Calgary. This post is about my recent experience working with the ArcGIS World Geocoding Service to find geographical locations of different places.
This experience is related to one of the project tasks of a grad course I took in the fall term. The project required developing JavaScript code to find specific locations using a geocoding service API. The ArcGIS World Geocoding Service is one of the most used geocoding APIs, so at the beginning of the project, I chose to learn about the API using ArcGIS tutorials.
In the first tutorial I followed, I built an app to find addresses and places with the ArcGIS World Geocoding Service. There are basically three steps for the tutorial: 1) get a starter app, 2) add code to enable searching for places (geocode), and 3) find an address using x/y location (reverse geocode). The tutorial provided us the stater app in CodePen so we do not need to develop the starter app ourselves. After we fork the app and save it, we can develop our own code in this starter app. It’s quite easy to develop the code for geocoding with ArcGIS Online. We just need to add the necessary references to the search module in the require statement, create a search widget and set the view in the app, then it’s all done. We can type the location we want to search in the widget and then search the x/y location of the places. I searched Calgary in the widget, and the result is shown in Figure 1.
We can also do the reverse geocode by clicking on the map. It’s also not complicated to implement this function. We first add a click handler to the map view that we will use to initiate the reverse geocode process. The mapPoint from the click event is passed to the locationToAddress function of the geocoder. After that we call the showPopup function to display the resulting address information as a pop-up in the map view.
There are also more challenges and tutorials for developers to try, such as searching other layer data on the map, or searching for coffee shops, gas stations, and other nearby places. There are lots of options to try if you are interested in developing applications using this kind functionality.