Select to view content in your preferred language

Adding Geoprocessing to HTML or Java

5227
29
11-06-2015 02:46 AM
JasonSchelte
Deactivated User

I am working on a project and I am pretty stuck. I would like to create a route based on directions. That is the easy part. Then do a search for a particular service, Gas Stations, Restaurants, Stores. I want the particular location along my route. My guess would be to create a buffer around my route (based on how far I would be willing to go off my route), and then clip the services that fall within the buffer. The issue with most searches is that when I do the search it gives me a radius search from my location or beginning location. I would like to find services along my route to help me choose the best location for a ce to stop.

I added a script, which is basically the Directions API. I like the way it is formatted with the options on the right. I am open to some ideas if anyone has any.

Thanks for your help.

Jason

0 Kudos
29 Replies
JasonSchelte
Deactivated User

https://developers.arcgis.com/javascript/jssamples/search_basic.html

There is an example search query script in the samples part of the API

section. Maybe I am confused too. Do you know of a service that has a search

function like a google map search?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

   That example is using a locator service not a map service. To be able to do a spatial search (i.e. intersection of a POI point and the buffer) you have to have a map service that contains those POIs.

0 Kudos
JasonSchelte
Deactivated User

I have done a quick search. I don't see anything that comprehensive without

paying for some sort of data bundle from a website. Have you seen any sort of

map service that has a pretty good amount of locations that would be useful. I

am heading home soon, I added my personal email, if possible can you reply to

all.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

   I am not aware of such a service.

0 Kudos
JasonSchelte
Deactivated User

Robert, I have access to the data now and will start putting it together.

Should I try to sort the type of restaurant or group them? Also have you had a

chance to think about the way to set up this file?

Jason

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

Should I try to sort the type of restaurant or group them

I don't have a clue. Consider what you goals are.

As far as the development and code. First let me warn you that this is going to be a challenge for a beginner/novice.

  1. First you are using the directions widget so you will want to attach a dojo event listener to the directions dijit "directions-finish" event and get the route results route graphic.
  2. Now that you have the route graphic you will need to buffer that using a GeometryService object. Here is a sample that will give you a beginning point: Geometry Service - Buffer | ArcGIS API for JavaScript
  3. Once you have the buffer graphic you will want to do a QueryTask using the buffer graphic as the Queries geometry. Here is another sample that you can use a starting point for that portion: Select with Feature Layer | ArcGIS API for JavaScript
  4. Then you decide what to do with the query results do you wan to display them on the map or as text some how in your app.

You have a long road ahead of learning the JS API to accomplish this.

JasonSchelte
Deactivated User

Hey Robert, I have the beginning piece put together. I am working on getting

the data put together. The map did not show when I tried to run it. Can you

see any issues in it?

Jason

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

    What am I suppose to be looking at? Did you update the original attachment?

0 Kudos
JasonSchelte
Deactivated User

Robert, that is the updated script with the directions and the buffer portions

on it. I also have the data now, but it was more than 1000 points so I am

going to have to bring it down to a lesser amount. Unless I can get one of the

servers up and running. Are you able to review the script to see if I am on

the right track. Also now that I have the data what should I be doing to show

the points within the buffer?

Jason

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

   I don't see a thing different in the attached script. People in GeoNet will be more than happy to assist with coding when individuals get stuck, but this is not a place where you ask other to do the coding for you. You may needed to hire a consulting company for this as what you are wanting to do is not as simple as copy and pasting a couple of scripts together.

0 Kudos