说明
aie.Map,构造一个地图组件Map对象,用于可视化渲染计算结果。坐标系固定为EPSG:4326。
阿里AI Earth中,坐标系默认为EPSG:4326
效果
import aie
aie.Authenticate()
aie.Initialize()
my_province = aie.FeatureCollection('China_Province').filter(aie.Filter.eq('province', '广东省')).geometry()
my_city = aie.FeatureCollection('China_City').filter(aie.Filter.eq('city', '广州市')).geometry()
my_district = aie.FeatureCollection('China_District').filter(aie.Filter.eq('district', '天河区')).geometry()
map = aie.Map(
center=my_province.getCenter(),
height=800,
zoom=7
)
img_params = {
'min': 0,
'max': 1,
}
map.addLayer(
my_province,
img_params,
bounds=my_province.getBounds()
)
map.addLayer(
my_city,
img_params,
bounds=my_province.getBounds()
)
map.addLayer(
my_district,
img_params,
bounds=my_province.getBounds()
)
map
备注:内置投影转换
aie.Feature.transform
将构成矢量对象的顶点坐标转换到指定投影上。
import aie
aie.Authenticate()
aie.Initialize()
selfFeature = aie.Feature(aie.Geometry.Point([120, 21]), {'key': 'val'})
transFeature = selfFeature.transform('EPSG:3857')
print(transFeature.getInfo())
aie.Geometry.transform
将几何对象的顶点坐标转换到指定投影上。
import aie
aie.Authenticate()
aie.Initialize()
point = aie.Geometry.Point([120, 21])
transFeature = point.transform('EPSG:3857')
print(transFeature.getInfo())