Arcgis engineering projects can add various types of spatial resources, such as database spatial tables and shp files. The coordinate system of each spatial table may be different, and the coordinate system can be set uniformly when they are put into a project.
This article will introduce three scenarios in ArcGis that require coordinate transformation:
- Arcgis Pro set project coordinates
- GP analysis specifies output result coordinate system
- Specify a coordinate system when publishing a layer or feature service using python
1, Arcgis Pro set project coordinates
Each layer in the arcgis pro project can be viewed from the attribute to the coordinate system.
To uniformly convert the coordinates to 4490, you can set it in the base map
2. GP analysis specifies output result coordinate system
When the parameters of GP analysis are database spatial tables or spatial files, it is not necessary to convert the source coordinate system, but only need to specify the output coordinate system when submitting GP analysis. Specify parameters when submitting GP analysis in
java
3. Specify the coordinate system when publishing a layer or feature service using python
When I publish map services in the project, I usually add layers in the local template project, and then save it as a draft file to upload and publish. The
complete script can refer to several other articles in my ArcGis series
. The following is a way to add a database space table and set the project coordinate system. The key code:
# aprx存储路径
aprx = arcpy.mp.ArcGISProject(mpmath)
# 要将数据添加到aprx中的哪个地图下
aprx_map = aprx.listMaps("*")[0]
# 将sde文件下的指定某空间表添加到项目中
aprx_map.addDataFromPath(table_path)
#设置指定坐标系
out_coordinate_system = arcpy.SpatialReference(4490)
aprx_map.spatialReference = out_coordinate_system
aprx.save()