Below is the code in which we can access a feature layer from ArcGIS sample server.

queryTask = new esri.arcgis.gmaps.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3");

But I want to access my own .shp file residing on my local computer or on another server, e.g this..

queryTask = new esri.arcgis.gmaps.QueryTask("");

In this case, queryTask does not return featureSet and so .shp file could not display on Map.

Where is the problem and how can I fix it?

  • Autodesk has an open url technology. But ESRI hasn't ever supported that.
    – Brad Nesom
    Feb 8, 2011 at 14:20

1 Answer 1


From the structure of your code, it seems that your query expects to connect to a rest/georest server in order to obtain the map you would like it to display. If your could accept direct connection to a shapefile, then you would only need to host it on a webserver and point to it (just like you are already trying to do), but that does not seem to be the case. It looks like you will need to setup a georest server where you can load the shapefiles you would like to serve and only then reconstruct the query pointing to where this loaded map is being served.

I think your code is expecting you to setup and use arcgis server; but there are several free alternatives like mapserver and geoserver. Personally, I go with geoserver - take a look at http://docs.geoserver.org/stable/en/user/ for instructions as to how to install and load maps.

  • Thanks for reply. Actually i want to access shapefiles form our web server as you see from code. But I dont know how to point to it and how i can access featureSet. Can u help me what should i do ? I dont want to setup georest server for this purpose.
    – user1899
    Feb 8, 2011 at 12:33
  • 1
    Is your code part of the google maps api that esri provides? If that is the case, there is no way of serving a shapefile pointing directly to it. If you just want to have access to the raw .shp file -- to use in arcmap, for example --, create a shared directory on the network if it is a local network; or setup a vpn for a remote connection.
    – relima
    Feb 8, 2011 at 13:27
  • I have downloaded and installed geoserver and publish one shapefile. Now how can i access that shapefile to use its featureSet ? From Esri sample server we access the file by using following code: queryTask = new esri.arcgis.gmaps.QueryTask("sampleserver1.arcgisonline.com/ArcGIS/rest/services/…); Similarly like code above, which piece of code i use to access .shp file from geoserver ?
    – user1899
    Feb 10, 2011 at 15:16
  • @user1899, if you go into the demo section of geoserver's administration web page, you can see examples of links to multiple services that you can use. Note that the rest service is only installed by default if you have the latest release candidate. Otherwise, you will need to install the rest plugin to make the same type of query you have been doing.
    – relima
    Feb 10, 2011 at 15:41
  • Thanks again, You mean I have to use this(localhost:8080/geoserver/wfs) line of code in place of ("sampleserver1.arcgisonline.com/ArcGIS/rest/services/…); am i right ?
    – user1899
    Feb 10, 2011 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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