1

I'm new to GIS concepts so this might be a noob question. I'm using OpenLayers 3 for map. I want to restrict the panning to a specific area.

The code that I came across should do it but I don't know the values to assign to minx, miny, maxx, and maxy variables.

    var view = new ol.View({
        center: new ol.proj.transform([-116.284636, 43.619528], 'EPSG:4326', 'EPSG:3857'),
        zoom: 11,
        extent: [minx, miny, maxx, maxy]
    });

I've gotten the coordinates from the click evt.coordinate variable but I don't know how they correlate to the parameters of the extent.

    left top
    '0' => "-12972739.566503541"
    '1' => "5427487.630417225"

    right top
    '0' => "-12913118.684441104"
    '1' => "5426723.260134374"

    bottom right
    '0' => "-12908838.210857134"
    '1' => "5364962.141279951"

    bottom left
    '0' => "-12983440.750463465"
    '1' => "5367713.874298218"

Can someone explain how to take the coordinates and create a new extent?

Thanks

Jonatas Walker
  • 13,583
  • 5
  • 53
  • 82
Kathy Judd
  • 715
  • 3
  • 9
  • 21

1 Answers1

2
minx = bottomleft[0]
miny = bottomleft[1]
maxx = topright[0]
maxy = topright[1]
itsyahani
  • 408
  • 3
  • 13