Coordinate checking map or application

1840
8
08-26-2014 08:40 AM
MichaelThompson2
Occasional Contributor

Hi all,

What I would like to do is create an AGOL map that has a few simple polygons and a search function where I can input a pair of coordinates and have it show the location on the map. The goal is to be able to quickly check coordinates to see if they fall inside or outside of the simple polygons. Is there a good way to do this?

Thank you!

0 Kudos
8 Replies
TimWitt2
MVP Alum

Michael,

you could just add the polygon layer to my widget.

Javascript API - Location Widget

Just type in your coordinates to the left and it will take you to it. If you have your polygon layer added, you will see if the coordinates fall in them.

Tim

0 Kudos
MichaelThompson2
Occasional Contributor

Hi Tim,

I have been playing around with your app a bit and I think this is something that would work great for me but I have a couple questions:

1. The location search doesn't work for me and the "Switch Basemap" menu is empty when it drops down. Did I do something wrong? I just saved the html file to my machine and opened it in a web browser.

2. Is there an easy way for this app to drop a pin on the input coordinates (similar to how Google Maps does it) so I caould easily see where the location is in addition to the window pop-up?

Thanks so much!

0 Kudos
TimWitt2
MVP Alum

Michael,

you have to copy the html file into the following folder:

C:\inetpub\wwwroot

And then open a browser and type the following.

http://<your computer name>/location.html

It will only work right, if you use your pc as a server.

If not you can always use my jsfiddle to test: Location, Location, Location... - JSFiddle

Hope this helps!

0 Kudos
MichaelThompson2
Occasional Contributor

Oh, you have to serve the page to get it working correctly. I'll give it a shot!

0 Kudos
TimWitt2
MVP Alum

Yes, when I first started working with the API I was wondering why the basemap gallery wasn't working, hehe. Once I did this, it started working.

0 Kudos
MichaelThompson2
Occasional Contributor

Alright, so this is working pretty well now. I have been able to tailor a few things to my liking, but I don't know how to add my polygons to the map. Is there a way to reference a particular AGOL map?

0 Kudos
TimWitt2
MVP Alum
0 Kudos
TimWitt2
MVP Alum

And here is an example with an added ArcGIS Online layer:

Location with ArcGIS Online Layer - JSFiddle

0 Kudos