How to plot an address without using Search and Location Button?

1100
14
10-23-2017 11:56 AM
MartinNitschke
New Contributor II

I have looked at the sample code which creates something far more complex than I am looking for.  I'd like to be able to click a link containing the address, which goes to my page with the Map on it.  I'd like to see the particular address marker, just as if you had typed in the Search widget, but without the necessity to even see a Search widget.  I am successfully able to load the map, but unable to figure out how to set a location by address.   Thanks.

Tags (1)
0 Kudos
14 Replies
ThomasSolow
Occasional Contributor III

Take a look at the world geocoder information: World Geocoding Service—ArcGIS REST API: World Geocoding Service | ArcGIS for Developers 


You should be able to send requests to the AGOL world geocoder to handle this for you.

0 Kudos
MartinNitschke
New Contributor II

I still do not see how to pass the result to the map to plot the point returned.  There are no code samples, just samples on how to call the API.  Thanks for your patience.

0 Kudos
ThomasSolow
Occasional Contributor III

Here's a sample that makes a request to the geocoding service and asks for 1 result and plots that on the view: https://codepen.io/solowt/pen/LzoQPe 

0 Kudos
MartinNitschke
New Contributor II

When I copy that code into an HTML page, it only loads a blank page.  No map and nothing happens. 

0 Kudos
ThomasSolow
Occasional Contributor III

Are you hosting the page with a web server?  If you're not there are different rules about whether your browser can make HTTP requests.

0 Kudos
MartinNitschke
New Contributor II

No. I just created an HTML page on my computer and tried to open it.  I could move it to a server to try it.  I did select Allow All Content when prompted.

0 Kudos
MartinNitschke
New Contributor II

Put it on the server and still a blank page.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Martin,

  What does your browsers web console say. Are there any errors there.

0 Kudos
MartinNitschke
New Contributor II

SCRIPT1002: Syntax error

}).then(response => {

0 Kudos