Document Maps JavaScript API Reference Manual Basic Class Bounds

Bounds

AMap.Bounds

Construct a rectangular range object to describe a rectangular range of latitude and longitude on the map

new AMap.Bounds(southWest: LngLat, northEast: LngLat);

Parameter

Attribute

Type

Description

southWest

LngLat

Latitude and longitude of the southwest corner

northEast

LngLat

Latitude and longitude values of the northeast corner

Demo

var southWest = new AMap.LngLat(100.456575, 13.74256); //Latitude and longitude coordinates of the southwest corner
var northEast = new AMap.LngLat(100.518716, 13.762569); //Latitude and longitude coordinates of the northeast corner
var bounds = new AMap.Bounds(southWest, northEast) //Create a latitude and longitude rectangle range for a feature object

Method

getSouthWest()

Get southwest corner coordinates

return value:(LngLatSouthwest corner coordinates

Demo:

bounds.getSouthWest();

getNorthEast()

Get northeast corner coordinates

return value:(LngLatNortheast corner coordinates

Demo:

bounds.getNorthEast();

getNorthWest()

Get northwest corner coordinates

return value:(LngLatNorthwest corner coordinates

Demo:

bounds.getNorthWest();

getSouthEast()

Get southeast corner coordinates

return value:(LngLatSoutheast corner coordinates

Demo:

bounds.getSouthEast()

contains(obj)

Whether the specified point coordinates are within the rectangle range

Parameter:obj(LngLatThe point coordinates to be specified

return value:(BooleanWhether it is within the range

Demo:

bounds.contains(new AMap.LngLat(77.193045, 28.59086));

getCenter()

Get the latitude and longitude coordinates of the center point of the current Bounds

return value:(LngLatThe latitude and longitude coordinates of the center point of the current Bounds

Demo:

bounds.getCenter();

toString()

Returns the rectangular bounds of the map object as a string

return value:(Stringrectangular range in string form

Demo:

bounds.toString();