开发 Maps JavaScript API Reference Manual Basic Class Bounds

Bounds 最后更新时间: 2026年07月02日

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:(LngLat) Southwest corner coordinates

Demo:

bounds.getSouthWest();

getNorthEast()

Get northeast corner coordinates

return value:(LngLat) Northeast corner coordinates

Demo:

bounds.getNorthEast();

getNorthWest()

Get northwest corner coordinates

return value:(LngLat) Northwest corner coordinates

Demo:

bounds.getNorthWest();

getSouthEast()

Get southeast corner coordinates

return value:(LngLat) Southeast corner coordinates

Demo:

bounds.getSouthEast()

contains(obj)

Whether the specified point coordinates are within the rectangle range

Parameter:obj(LngLat) The point coordinates to be specified

return value:(Boolean) Whether 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:(LngLat) The 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:(String) rectangular range in string form

Demo:

bounds.toString();
返回顶部 示例中心 常见问题 智能客服 公众号
二维码