In this lab we’ll write an ArcGIS API for Javascript application that uses HTML5 to glean a user’s location and find out which census block they are inside.
Copy the contents of step_1.html into a new .html
file on your own machine and open it via http://
protocol in your browser.
Don’t have a local web server running?
You can find information to help you set one up here.
because of security rules introduced in Chrome 50 (on 4/20/2016), it is mandatory to configure https in order to take advantage of HTML5 location when you move your website into production.
Listen for the appropriate event to retrieve the current user’s location (once it’s available).
Include a QueryTask to pass the user location in a request to an Esri service that hosts US Census Block Groups.
Draw the feature that is retrieved as a new Graphic on the map.
In the end your app should look something like this:
ie: sample code ripe for stealing
are you thirsty for more?