1

I want to set the extent of my basemap on application start but when I add the following code it doesn't seem to like it and renders a blank div?

map = new Map("map", {
    logo: false,
    extent: new esri.geometry.Extent("xmin="-377930, "ymin"=470972, "xmax"=849893, "ymax"=1269406,  new SpatialReference({ wkid: 27700 }))
});

initLayer();
baseMapServiceLayer = new my.BaseMap();

I wasn't sure if I should replace esri.geometry.Extent with Extent but that makes no difference - any help would be good!

1

1 Answer 1

1

Stuff like:

"xmin="-377930, "ymin"=470972, "xmax"=849893, "ymax"=1269406

isn't valid as there aren't named (AKA keyword) arguments in JS (yet). Arguments to Extent are positional or you can use an object.

Here's the how you should do it:

var bounds = new Extent({
  "xmin": -377930,
  "ymin": 470972,
  "xmax": 849893,
  "ymax": 1269406,
  "spatialReference": { "wkid": 27700 }
});

And a full example showing a map in 27700 with a feature layer on it.

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.