public override void ExecuteSearch(string searchTerm, SEARCH_TYPE searchType, GISEnvelope searchArea, GISLayerInfo featureLayer) { if (searchType == SEARCH_TYPE.Geocode) { // http://{0}/{1}?SERVICE={2}&VERSION={3}&REQUEST=GetFeatureInfo&LAYERS={4}&QUERY_LAYERS={4}&STYLES=&BBOX={5}&FEATURE_COUNT=10&HEIGHT={6}&WIDTH={7}&FORMAT=image%2Fpng&INFO_FORMAT=text%2Fxml&SRS={8}&X={9}&Y={10} OGCEnvelope envelope = new OGCEnvelope(searchArea); string requestUrl = string.Format(FEATURE_INFO_URL, Server.Host, Server.ServletPath, OGC_SERVICE_TYPE.WMS, Server.Version, (featureLayer as OGCLayer).Id, (envelope as OGCEnvelope).ToBBoxString(), _imageHeight, _imageWidth, searchArea.CoordinateSystem, _imageWidth / 2, _imageHeight / 2); GISFeatureResponse response = new GISFeatureResponse(); response._envelope = searchArea; response._layers = new List<GISLayerInfo>() { featureLayer }; response.HasError = false; response.LastRequest = requestUrl; webClient.GetRequest(requestUrl, ProcessQueryResponse, response); } else { List<GISLayerInfo> layers = new List<GISLayerInfo>(); GetQueryLayers(Server.ActiveService, ref layers); string queryLayers = string.Empty; foreach (GISLayerInfo layer in layers) { queryLayers += layer.Id; } string requestUrl = GetUrl(OGC_OPERATION.GetFeatureInfo, OGC_SERVICE_TYPE.WMS, Server.ActiveService as OGCService, queryLayers.Cast<OGCLayer>(), new OGCEnvelope(searchArea), _imageWidth, _imageHeight); //http://<hostname>/<deploy_name>/com.esri.wms.Esrimap?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&SRS=EPSG:4326&BBOX=-117,38,-90,49&WIDTH=600&HEIGHT=400&QUERY_LAYERS=States&X=200&Y=150& GISFeatureResponse response = new GISFeatureResponse() { SearchTerm = searchTerm }; response._envelope = new GISEnvelope(); response._layers = new List<GISLayerInfo>() { new OGCLayer("Search", "Search") }; response.HasError = false; response.LastRequest = requestUrl; webClient.GetRequest(requestUrl, ProcessSearchResponse, response); } }
public override bool Identify(int xpoint, int ypoint, double latitude, double longitude, GISEnvelope envelope, GISLayerInfo featureLayer) { // http://maps.google.com/maps/api/geocode/xml?latlng=40.714224,-73.961452&sensor=true try { if (featureLayer == null) return false; envelope = new OGCEnvelope(envelope); //string layerString = featureLayer.Id; string requestUrl = GetUrl(OGC_OPERATION.GetFeatureInfo, OGC_SERVICE_TYPE.WMS, Server.ActiveService as OGCService, new List<OGCLayer>() { featureLayer as OGCLayer }, envelope as OGCEnvelope, _imageWidth, _imageHeight, xpoint, ypoint); GISFeatureResponse response = new GISFeatureResponse(); response._envelope = BuildEnvelope(longitude, latitude, envelope, Server.MaxZoom * .9); response._layers = new List<GISLayerInfo>() { featureLayer }; response.HasError = false; response.LastRequest = requestUrl; webClient.GetRequest(requestUrl, ProcessQueryResponse, response); return true; } catch (Exception ex) { return false; } }
public override bool Identify(int xpoint, int ypoint, double latitude, double longitude, GISEnvelope envelope, GISLayerInfo featureLayer) { try { // http://{0}/ArcGIS/rest/services/{1}/{2}/identify?geometryType=esriGeometryPoint&geometry={{x:{3}, y:{4} }}&wkid={5}&layers=all:{6}&tolerance=10&mapExtent={7}&imageDisplay={8},{9},96&returnGeometry=true string layerid = featureLayer.Id; string requestUrl = string.Format(IDENTIFY_URL, _Server.Host, _Server.ActiveService.Id, _Server.ActiveService.ServiceType, longitude, latitude, envelope.CoordinateSystem, layerid, envelope.ToString(), _imageHeight, _imageWidth, Server.ServletPath); GISFeatureResponse response = new GISFeatureResponse(); response._envelope = BuildEnvelope(longitude, latitude, SelectEnvelope(Server.ActiveService), MaxZoom - 2); response._layers = new List<GISLayerInfo>() { featureLayer }; response.HasError = false; response.LastRequest = requestUrl; webClient.GetRequest(requestUrl, ProcessIdentifyResponse, response); return true; } catch (Exception ex) { Server.RaiseErrorResponse(new GISResponse() { _envelope = null, _layers = new List<GISLayerInfo>() { new EsriLayerInfo() { _name = "Search", _type = "Search" } }, ErrorMessage = ex.Message }); return false; } }