I've included a simple code example below to highlight how easy it is to integrate ArcGIS Server services via REST in your .NET app. The example uses an ArcGIS Online geocode service to geocode an address and return a location.
Download the sample here.
There are a few items to consider when using ArcGIS services via REST in .NET:
- You will construct the url that will execute an operation on the server. Inputs to the operation are included in the url as parameters with values. Add a reference to the System.Web.dll and use the HttpUtility class to encode parameter values in the url.
- In most cases you will return results in JSON (JavaScript Object Notation) format. Add a reference to the System.Web.Extensions.dll (included with .NET 3.5, separate install for .NET 2.0) and use the JavaScriptSerializer class to deserialize JSON results into a dictionary you can use more effectively.
This example can easily be modified for use in a .NET CLR trigger for SQL Server to geocode address information upon entry into a table -or- in a batch process to geocode addresses in a database -or- show a location in a WinForm or WPF desktop client. The same idea can cross over into other ArcGIS Server services such as querying layers in a map or executing a geoprocessing service. In any case, you'll find the simplicity of the REST API refreshingly simple for those scenarios where you need to plug a little GIS into your app. One parting note, if you use ArcGIS Online services via REST, you'll need to follow the subscription model for the Web Mapping APIs. For example if you geocode more than 1000 addresses, you'll need to purchase a subscription.
7 comments:
great post, can you do the same with the updateFeatures method of a FeatureServer?
Yes, but the web request method will need to be a POST. The edit operations on a feature service are POST only.
thx.
what about a queryTask that uses a complex polygon, lets say 50+ points in a json string? The Javascript API requires proxy server, but is it possible server side c#?
NOTE to Self: Never POST anything to a blog/forum late Friday afternoon after a big lunch!!
Issue resolved.
Thanx for posting....
Shree Ganesh stones
Would you be enthusiastic about exchanging hyperlinks? best online casinos
Nice post. I study one thing more difficult on different blogs everyday. It's going to at all times be stimulating to read content material from other writers and practice a little something from their store. I’d desire to use some with the content on my blog whether or not you don’t mind. Natually I’ll offer you a link in your internet blog. Thanks for sharing. best online casino
Post a Comment