月球大数据地理空间分析展示平台-【后端】-月球后台服务
13693261870
2023-12-04 45a773850057dd90c4292d30715b4f9dfdc86740
src/main/java/com/moon/server/service/data/ReadRasterService.java
@@ -2,6 +2,7 @@
import com.moon.server.entity.all.StaticData;
import com.moon.server.entity.data.MetaFileEntity;
import com.moon.server.helper.GeoHelper;
import com.moon.server.helper.StringHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -25,28 +26,7 @@
 */
@Service
public class ReadRasterService {
    private SpatialReference sr4326;
    private SpatialReference sr4490;
    private SpatialReference sr104903;
    private final static Log log = LogFactory.getLog(ReadRasterService.class);
    /**
     * 初始化空间引用
     */
    private void initSpatialReference() {
        if (null == sr4326) {
            sr4326 = new SpatialReference();
            sr4326.ImportFromEPSG(StaticData.I4326);
            sr4490 = new SpatialReference();
            sr4490.ImportFromEPSG(StaticData.I4490);
            sr104903 = new SpatialReference(StaticData.MOON_2000_WKT);
        }
    }
    /**
     * 读取栅格信息
@@ -204,8 +184,6 @@
     * 坐标转换
     */
    private Geometry transform(Dataset ds, Geometry point) {
        this.initSpatialReference();
        point.AssignSpatialReference(ds.GetSpatialRef());
        if (ds.GetSpatialRef().IsGeographic() > 0) {
            return point;
@@ -213,9 +191,9 @@
        String srsName = ds.GetSpatialRef().GetName();
        if (srsName.contains(StaticData.CGCS2000)) {
            point.TransformTo(sr4490);
            point.TransformTo(GeoHelper.sr4490);
        } else {
            point.TransformTo(sr4326);
            point.TransformTo(GeoHelper.sr4326);
        }
        point.SwapXY();