I am using OpenLayers application and sending WMS query to my geoserver. My polygon is sending to server and gets intersected features.

var feature = Mypolygon;

 var filter = new OpenLayers.Filter.Spatial({
     type: OpenLayers.Filter.Spatial.INTERSECTS,
     value: feature.geometry

var protocol = new OpenLayers.Protocol.WFS({
    version: "1.1.0",
    url:  "http://mydomain/geoserver/wfs",
    featureType: "my_points",
    featureNS: "http://www.openplans.org",
    geometryName: "the_geom"

    filter: filter,
    callback: function (e) {}

This way is working to query geoserver WFS service. But I need to send query to a ArcGIS rest service. Mypolygon will be sent to ArcGIS service and get intersected polygons.


I can use ajax call to Arcgis Rest, but how can I send Mypolygon as a parameter? is this possible?

  • I had been looking into something similar. My thoughts were that I would generate an AJAX request to my REST service with input data and send it to my ArcGIS Service. You should be able to grab the input parameters from the Service's page and adjust your AJAX request accordingly. Definitely post what you find out here!
    – Branco
    Sep 23 '14 at 20:13
  • Yes, using ajax is a good solution. But I can not send my polygon as a paramater to arcgis server. How can I do this?
    – barteloma
    Sep 24 '14 at 6:06
  • I think you're on the right track with the AJAX call. Can you convert Mypolygon to Esri's JSON polygon format? The ArcGIS Server REST API's Query page has some hints, but doesn't include a complicated polygon. Does that page help? Sep 24 '14 at 6:55
  • You also may be able to convert the polygon into a FeatureSet, which is used as return objects and inputs into GP tasks. There would be some conversions between the ESRI script an OpenLayers, but it might work. See: developers.arcgis.com/javascript/jsapi/featureset-amd.html
    – Branco
    Sep 24 '14 at 13:01

Esri can recieve a json request with a perimeter like so


0,0,60,20 is the 4 points in the parimeter

To send json in your app, call like so:

var queryURL = "http://mapservices/arcgis/rest/services/Mypoints/MapServer/0/query?geometry=0,0,60,20&geometryType=esriGeometryEnvelope&outFields=*&f=json";
var jsonp = new OpenLayers.Protocol.Script();
            f: 'json', 
            pretty: 'true'
        },function(data) {
            //Do something with json obj

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.