Select to view content in your preferred language

Need help to changing ESRI base map to ArcServer Base map

983
3
05-09-2013 01:28 PM
GyeyoungChoi
Deactivated User
Hello,

I was working with a sample
http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/find_map_datagrid.html
but for my school project I have to use ArcServer base map so I tried but did not work so far.
Any one can tell me what did I do wrong please?

Thank you,

Jack


Want to change from
function init() {
        dojo.connect(grid, "onRowClick", onRowClickHandler);

        center = [-83.266, 42.568];
        zoom = 11;
        map = new esri.Map("map", { 
          basemap: "streets",
          center: center,
          zoom: zoom
        });

        //Create Find Task using the URL of the map service to search
        findTask = new esri.tasks.FindTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/TaxParcelQuery/MapServer/");

        dojo.connect(map, "onLoad", function() {
          //Create the find parameters
          findParams = new esri.tasks.FindParameters();
          findParams.returnGeometry = true;
          findParams.layerIds = [0];
          findParams.searchFields = ["OWNERNME1","OWNERNME2"];
          findParams.outSpatialReference = map.spatialReference;
          console.log("find sr: ", findParams.outSpatialReference);
        });
      }


TO

function init() {
        dojo.connect(grid, "onRowClick", onRowClickHandler);
  var initExtent = new esri.geometry.Extent({"xmin":1076363,"ymin":3109863,"xmax":1084228,"ymax":3113693,"spatialReference":{"wkid":32139}});

 map = new esri.Map("map",{
          infoWindow:popup,
          extent:initExtent,logo: false,
    
    zoom: 2,
          sliderStyle: "large"
        });
   
        //dojo.connect(map,"onLoad",mapReady);

 var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://localhost:6080/arcgis/rest/services/COR/basemap/MapServer");
        map.addLayer(basemap);

        //Create Find Task using the URL of the map service to search
        findTask = new esri.tasks.FindTask("http://localhost:6080/arcgis/rest/services/COR/intmap/MapServer");

        dojo.connect(map, "onLoad", function() {
          //Create the find parameters
          findParams = new esri.tasks.FindParameters();
          findParams.returnGeometry = true;
          findParams.layerIds = [0,1,2,3];
          findParams.searchFields = ["Number","Name","Abbrev"];
          findParams.outSpatialReference = map.spatialReference;
          console.log("find sr: ", findParams.outSpatialReference);
        });
      }


The server is working fine and also without changing basemap findtask is working as well.
0 Kudos
3 Replies
ShreyasVakil
Frequent Contributor
There are 2 things I can point out by looking at your code :

1. you have used a popup to define map's infoWindow property, but never created the popup in your code.
2. there can be some issues with extent you have defined.

try the following for your init function:

 map = new esri.Map("map");
  var baseMapLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://localhost:6080/arcgis/rest/services/COR/basemap/MapServer");
        map.addLayer(baseMapLayer);
  


keep the map as simple as possible at first and check if you see the basemap and once you get your basemap to work, slowly start adding more properties to it.

Let me know if it helps.
0 Kudos
GyeyoungChoi
Deactivated User
There are 2 things I can point out by looking at your code :

1. you have used a popup to define map's infoWindow property, but never created the popup in your code.
2. there can be some issues with extent you have defined.

try the following for your init function:

 map = new esri.Map("map");
  var baseMapLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://localhost:6080/arcgis/rest/services/COR/basemap/MapServer");
        map.addLayer(baseMapLayer);
  


keep the map as simple as possible at first and check if you see the basemap and once you get your basemap to work, slowly start adding more properties to it.

Let me know if it helps.


Thanks Shreyas,

It worked! and a infoWindow is using for the popup but other code was not showing.

Thanks again
0 Kudos
ShreyasVakil
Frequent Contributor
Cool, I'm glad it worked!!

you can mark this as answered for others to see.
0 Kudos