Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added support for union operation

  • Loading branch information...
commit dcbf808fa41ac40d73a5bb5ac5203e6b335c9635 1 parent 5e0a47a
@geobabbler authored
Showing with 29 additions and 0 deletions.
  1. +29 −0 Analytics.cs
View
29 Analytics.cs
@@ -55,6 +55,7 @@ public class Analytics
private string _intersectTemplate = "{0}/analysis.json?calculation=intersect&ds1={1}&ds2={2}&merge={3}";
private string _clipTemplate = "{0}/analysis.json?calculation=clip&ds1={1}&ds2={2}";
private string _dissolveTemplate = "{0}/analysis.json?calculation=dissolve&ds1={1}&atr_1={2}";
+ private string _unionTemplate = "{0}/analysis.json?calculation=union&ds1={1}&ds2={2}&merge={3}";
#endregion
@@ -216,6 +217,34 @@ public AnalyticsResponse Intersect(int overlayid1, int overlayid2, MergeOptions
return retval;
}
+ public AnalyticsResponse Union(int overlayid1, int overlayid2, MergeOptions merge)
+ {
+ AnalyticsResponse retval = null;
+ try
+ {
+ GeoComWebClient request = new GeoComWebClient();
+ string mergestring = Enum.GetName(typeof(MergeOptions), merge);
+ string url = String.Format(_unionTemplate, EndpointURI, overlayid1, overlayid2, mergestring);
+ setCredentials(request);
+
+ //validateFileType(files);
+ string response = request.Post(url, UserName, Password, "application/json", "");
+ DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(GeoIQ.Net.Data.AnalyticsResponse));
+ byte[] bytes = Encoding.ASCII.GetBytes(response);
+ System.IO.MemoryStream stream = new System.IO.MemoryStream(bytes);
+ stream.Position = 0;
+ GeoIQ.Net.Data.AnalyticsResponse result = (GeoIQ.Net.Data.AnalyticsResponse)serializer.ReadObject(stream);
+
+ retval = result;
+ }
+ catch (Exception ex)
+ {
+ this.LastError = ex;
+ retval = null;
+ }
+ return retval;
+ }
+
#endregion
Please sign in to comment.
Something went wrong with that request. Please try again.