Hello everyone, I recently publish my site and it was working fine until today. I got this message:
http://screencast.com/t/BdTyk4X7
Do you know what it is? How can I fix this? When I run the same code locally, it is working fine.
Thanks
Hi Ryan,
You can try using Chrome Developer Tools or IE debugging to get more information about errors.
One thing with geometry services is that they often require a proxy to be configured.
Owen
Ryan,
Another bit of advice is that esri sample servers are NOT meant to be used in production environments. You should always change to use your own servers geometry service.
Sample Services: Licensee may use these services for internal evaluation and development purposes only. All licenses for ArcGIS Online Services are subject to these terms of use and any additional restrictions or requirements identified in the Documentation
Sample Services:
Licensee may use these services for internal evaluation and development purposes only. All licenses for ArcGIS Online Services are subject to these terms of use and any additional restrictions or requirements identified in the Documentation
Thanks Owen for the reply. I am new to arcgis. I saw the sample code and here is how it uses the service:
geometryService = new GeometryService("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
I am wondering what you mean by using proxy? Does it mean I can't use the url that way? If so could you point me to the right place?
Thanks.
Thanks Robert. That's what I figure. Could you share with me some articles on how I can set this up? I am new to this.
The Using the proxy | Guide | ArcGIS API for JavaScript page describes the cases in which you may require a proxy. However, having a proxy configured doesn't change the way that you create and use the geometry service in your code.
I would start by using some debugging tools to determine exactly why the request is failing. Can you post the URL to the published site?
Sure here is the documentation link for starting the geometry service from Desktop on your ArcGIS Server: http://resources.arcgis.com/en/help/main/10.1/index.html#//0154000004zs000000
and this one is for doing the same using ArcGIS Server Manager:
http://resources.arcgis.com/en/help/main/10.1/index.html#/Starting_the_geometry_service_in_Manager/0154000004zq000000/
Robert, I have a question. I quickly read the document and it seems that I would need my own server machine to host this. Is it correct? If it is the case, then it is a problem for me since I host my site with a hosting service and there is no way they will allow me to do that on their server.
Owen, I inspected element using google chrom and here is the error:
XMLHttpRequest cannot load http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geomet…43794057776715%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D%5D%7D. The 'Access-Control-Allow-Origin' header has a value 'http://localhost:6179' that is not equal to the supplied origin. Origin 'http://example.com' is therefore not allowed access.
The message seems to refer to localhost. Where can I change that?
Yes this would require you to have ArcGIS Server and all of it's system requirements. Do you at least have a ArcGIS Organizational account where you are hosting your organizations data, and can satisfy the esri terms of use requirements?
Robert, I am still learning this. So please be patient with me here. I used asp.net and I learned how to code through the sample codes in ArcGIS API for JavaScript. I have not run across any requirement about ArcGIS organizational account. Could you please explain a little bit more? What kind of organization data are we talking about here? All I need for my web application is the basemap and arcgis services. Do I need to host any data in this case? I would appreciate it if you could give me some real examples just to clear this up.
I can not do anything but provide the link to esri terms and conditions for use of Web Mapping APIs and ArcGIS Online Services:
Terms of Use | ArcGIS for Developers
These type of use questions have been asked on GIS Stack Exchange before:
Is the ArcGIS Server JavaScript API free to use? - Geographic Information Systems Stack Exchange
Just one question about hosting organization data. What kind of data is it? What I have in mind is perhaps my company needs to some map of its own and then it would need to host that map data. But in my case, I don't need that yet. I only need the basemap from arcmap, which will be pull using the javascript api. So is it this data that you are referring to?
This would be any data that you need in your application that is not provided by one of esris online services already. Say you were wanting to show points on the map for where there is crime in your area. Well it is highly unlikely that esri will have a service with that type of data for your area, but if you did then you could take the data that you have and publish a map service of this data (either using your ArcGIS Server or your AGOL orgazational account).
Thanks Robert. In my case, I don't need that level of map yet. I just need a generic map which is pulled using the javascript api. I then projected my drawing on the fly. So actually I don't need to host any data don't I? My only concern now is the use of services on sampleserver. I know it is sampleserver, so there is limitations. Based on the article you shared, the api should be free since it is for non commercial use. Just wondering how I can avoid relying on the sampleserver.
here is a link to a 10.04 ArcGIS Server that is not a sample server.
http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer
Robert, thanks for the link. It seems to work fine now. The map is loading fine. But when I inspected the code, I got this error. Any idea how to fix this?
XMLHttpRequest cannot load http://tasks.arcgisonline.com/ArcGIS/rest/info?f=json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://example.com' is therefore not allowed access.
That goes back to what Owen originally responded with. You may need to use a proxy. So the first thing you have to do is setup a proxy on your hosting service. Go to the esri GitHub Proxy Recource repository and download the flavor of Proxy that your hosting service will allow (asp.net, php, java, etc). Then go through the instructions for setting it up with server urls. Once that is done then you just look at that Link that Owen provided and add those line to specify your proxy url.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.