| | |
| | | } |
| | | |
| | | List<MetaFileEntity> meList = baseUploadService.uploadData(null, null, false, req, res); |
| | | if (meList == null || meList.size() < StaticData.FOUR) { |
| | | if (meList == null || meList.size() < StaticData.I4) { |
| | | return fail("没有找到已上传的数据或不完整", null); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | List<MetaFileEntity> list = baseUploadService.uploadData(null, null, false, req, res); |
| | | if (list == null || list.size() < StaticData.FOUR) { |
| | | if (list == null || list.size() < StaticData.I4) { |
| | | return fail("没有找到已上传的数据或不完整", null); |
| | | } |
| | | |
| | |
| | | */ |
| | | public static String[] EXCLUDE_PATH = new String[]{"/sign/", "/perms/", "/floatserver/", "/proxy/", "/swagger", "/error"}; |
| | | |
| | | public final static int TWO = 2; |
| | | public final static int I0 = 0; |
| | | |
| | | public final static int THREE = 3; |
| | | public final static int I1 = 1; |
| | | |
| | | public final static int FOUR = 4; |
| | | public final static int I2 = 2; |
| | | |
| | | public final static int I3 = 3; |
| | | |
| | | public final static int I4 = 4; |
| | | |
| | | public final static int I5 = 5; |
| | | |
| | | public final static int NINE = 9; |
| | | |
| | |
| | | /** |
| | | * 栅格数据扩展名 |
| | | */ |
| | | public final static List<String> RASTER_EXT = new ArrayList<>(Arrays.asList(".img", ".tif", ".tiff", "jpg", "jp2")); |
| | | public final static List<String> RASTER_EXT = new ArrayList<>(Arrays.asList(".img", ".tif", ".tiff", ".jpg", ".jp2")); |
| | | |
| | | /** |
| | | * MPT文件扩展名 |
| | |
| | | /** |
| | | * Mapper排除扩展名 |
| | | */ |
| | | public final static List<String> MAPPER_EXCLUDE_EXT = new ArrayList<>(Arrays.asList(".jpg.aux.xml", ".jpg.xml", ".jp2.aux.xml", ".jp2.xml", ".jp2.html", ".jp2.txt", ".img.aux.xml", ".img.xml", ".tif.aux.xml", ".tif.xml", ".tiff.aux.xml", ".tiff.xml", ".shp.xml")); |
| | | public final static List<String> MAPPER_EXCLUDE_EXT = new ArrayList<>(Arrays.asList(".jpg.aux.xml", ".jpg.xml", ".jp2.aux.xml", ".jp2.xml", ".jp2.html", ".jp2.txt", ".img.aux.xml", ".img.xml", ".tif.aux.xml", ".tif.xml", ".tiff.aux.xml", ".tiff.xml", ".shp.xml", ".ecw.xml", "ecw.aux.xml")); |
| | | |
| | | /** |
| | | * 所有文件扩展名 |
| | |
| | | .replace("?" + res.getArgs() + "&", "?").replace("&" + res.getArgs() + "&", "&"); |
| | | } |
| | | |
| | | if (StaticData.THREE == res.getCategory() && str.contains(StaticData.REST_LAYER)) { |
| | | if (StaticData.I3 == res.getCategory() && str.contains(StaticData.REST_LAYER)) { |
| | | str = str.replace(res.getUrl().replace("/v6/wmts/", StaticData.REST_LAYER), proxyUrl.replace("/proxy/", "/proxy/rest/")); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | ds = gdal.Open(file, gdalconst.GA_ReadOnly); |
| | | if (null == ds || ds.getRasterCount() == 0) { |
| | | if (null == ds || ds.getRasterCount() == 0 || null == ds.GetSpatialRef()) { |
| | | return; |
| | | } |
| | | |
| | | SpatialReference sr = ds.GetSpatialRef(); |
| | | if (sr != null) { |
| | | // 坐标系统 |
| | | mf.setCoorSys(sr.GetName()); |
| | | if (StaticData.MOON200.equals(mf.getCoorSys())) { |
| | | // EPSG编码 |
| | | mf.setEpsg("ESRI:" + StaticData.I104903); |
| | | } else { |
| | | String code = sr.GetAuthorityCode(null); |
| | | // EPSG编码 |
| | | mf.setEpsg(StringHelper.isEmpty(code) ? null : "EPSG:" + code); |
| | | } |
| | | // 坐标系统 |
| | | mf.setCoorSys(sr.GetName()); |
| | | if (StaticData.MOON200.equals(mf.getCoorSys())) { |
| | | // EPSG编码 |
| | | mf.setEpsg("ESRI:" + StaticData.I104903); |
| | | } else { |
| | | // EPSG编码:PROJCS、GEOGCS、GEOGCS|UNIT 或 NULL |
| | | String code = sr.GetAuthorityCode(null); |
| | | mf.setEpsg(StringHelper.isEmpty(code) ? null : "EPSG:" + code); |
| | | } |
| | | |
| | | // 行列数 |
| | |
| | | mf.sethDatum(null); |
| | | |
| | | // 分辨率 |
| | | double[] transform = new double[6]; |
| | | ds.GetGeoTransform(transform); |
| | | mf.setResolution(String.format("%f,%f", transform[1], transform[5])); |
| | | double[] tr = new double[6]; |
| | | ds.GetGeoTransform(tr); |
| | | mf.setResolution(String.format("%f,%f", tr[1], tr[5])); |
| | | |
| | | if (!StaticData.EPSGS.contains(mf.getEpsg())) { |
| | | if (tr[StaticData.I0] == 0.0 && tr[StaticData.I1] == 1.0 && tr[StaticData.I2] == 0.0 && tr[StaticData.I3] == 0.0 && tr[StaticData.I4] == 0.0 && tr[StaticData.I5] == 1.0) { |
| | | return; |
| | | } |
| | | Geometry minPoint = getMinPoint(ds); |
| | |
| | | double[] transform = new double[6]; |
| | | ds.GetGeoTransform(transform); |
| | | |
| | | String epsg = ds.GetSpatialRef().GetAuthorityCode(null); |
| | | double xMin = transform[0]; |
| | | double yMin = transform[3] - ds.getRasterYSize() * transform[1]; |
| | | |
| | | Geometry point = new Geometry(ogr.wkbPoint); |
| | | point.AddPoint(xMin, yMin, 0); |
| | | |
| | | return transform(ds, point, epsg); |
| | | return transform(ds, point); |
| | | } |
| | | |
| | | /** |
| | | * 获取Dataset的最大点 |
| | | */ |
| | | private Geometry getMaxPoint(Dataset ds) { |
| | | /** |
| | | * transform[0] 左上角x坐标 |
| | | * transform[1] 东西方向分辨率 |
| | | * transform[2] 旋转角度, 0表示图像 "北方朝上" |
| | | * |
| | | * transform[3] 左上角y坐标 |
| | | * transform[4] 旋转角度, 0表示图像 "北方朝上" |
| | | * transform[5] 南北方向分辨率 |
| | | */ |
| | | double[] transform = new double[6]; |
| | | ds.GetGeoTransform(transform); |
| | | |
| | | String epsg = ds.GetSpatialRef().GetAuthorityCode(null); |
| | | double xMax = transform[0] + (ds.getRasterXSize() * transform[1]); |
| | | double yMax = transform[3]; |
| | | |
| | | Geometry point = new Geometry(ogr.wkbPoint); |
| | | point.AddPoint(xMax, yMax, 0); |
| | | |
| | | return transform(ds, point, epsg); |
| | | return transform(ds, point); |
| | | } |
| | | |
| | | /** |
| | | * 坐标转换 |
| | | */ |
| | | private Geometry transform(Dataset ds, Geometry point, String epsg) { |
| | | private Geometry transform(Dataset ds, Geometry point) { |
| | | this.initSpatialReference(); |
| | | |
| | | if (StringHelper.isEmpty(epsg)) { |
| | | point.AssignSpatialReference(sr104903); |
| | | return point; |
| | | } |
| | | if (String.valueOf(StaticData.I4326).equals(epsg)) { |
| | | point.AssignSpatialReference(sr4326); |
| | | return point; |
| | | } |
| | | if (String.valueOf(StaticData.I4490).equals(epsg)) { |
| | | point.AssignSpatialReference(sr4490); |
| | | point.AssignSpatialReference(ds.GetSpatialRef()); |
| | | if (ds.GetSpatialRef().IsGeographic() > 0) { |
| | | return point; |
| | | } |
| | | |
| | | point.AssignSpatialReference(ds.GetSpatialRef()); |
| | | if (ds.GetSpatialRef().GetName().contains(StaticData.CGCS2000)) { |
| | | String srsName = ds.GetSpatialRef().GetName(); |
| | | if (srsName.contains(StaticData.CGCS2000)) { |
| | | point.TransformTo(sr4490); |
| | | } else { |
| | | point.TransformTo(sr4326); |
| | | } |
| | | point.SwapXY(); |
| | | |
| | | return point; |
| | | } |
| | |
| | | public void insertFiles(UserEntity ue, List<MetaFileEntity> list, HttpServletRequest req) { |
| | | checkMetaFiles(ue, list); |
| | | readRasterInfo(list); |
| | | List<MetaFileEntity> xlsList = getExcelFiles(list); |
| | | loadData(list); |
| | | copyFiles(list); |
| | | insertMetas(list); |
| | | if (xlsList.size() > 0) { |
| | | String guid = excelLoader(xlsList, req); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | // 9.获取资源实体 |
| | | ResEntity entity = getResEntity(ue, resId); |
| | | if (null == entity || StaticData.TWO != entity.getStatus() || StringHelper.isNull(entity.getProxy()) || StringHelper.isNull(entity.getUrl())) { |
| | | if (null == entity || StaticData.I2 != entity.getStatus() || StringHelper.isNull(entity.getProxy()) || StringHelper.isNull(entity.getUrl())) { |
| | | WebHelper.writeStr2Page(res, ILLEGAL_RESOURCE); |
| | | return; |
| | | } |
| | |
| | | insert into lf.sys_meta |
| | | (eventid,metaid,verid,name,type,guid,path,sizes,tab,rows,create_user,create_time,bak,geom,layer,depcode,dircode,ismeta,sensortype,acq_time,resolution,gridsize,coor_sys,epsg,h_datum,mata_type,bands,band_type,ct) |
| | | values |
| | | (#{eventid},#{metaid},#{verid},#{name},#{type},#{guid},#{path},#{sizes},#{tab},#{rows},#{createUser},now(),#{bak},${geom},#{layer},#{depcode},#{dircode},#{ismeta},#{sensortype},now(),#{resolution},#{gridsize},#{coorSys},#{epsg},#{hDatum},#{mataType},#{bands},#{bandType},#{ct}) |
| | | (#{eventid},#{metaid},#{verid},#{name},#{type},#{guid},#{path},#{sizes},#{tab},#{rows},#{createUser},now(),#{bak},${geom},#{layer},#{depcode},#{dircode},#{ismeta},#{sensortype},#{acqTime},#{resolution},#{gridsize},#{coorSys},#{epsg},#{hDatum},#{mataType},#{bands},#{bandType},#{ct}) |
| | | </insert> |
| | | |
| | | <insert id="inserts"> |
| | |
| | | (eventid,metaid,verid,name,type,guid,path,sizes,tab,rows,create_user,create_time,bak,geom,layer,depcode,dircode,ismeta,sensortype,acq_time,resolution,gridsize,coor_sys,epsg,h_datum,mata_type,bands,band_type,ct) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | (#{item.eventid},#{item.metaid},#{item.verid},#{item.name},#{item.type},#{item.guid},#{item.path},#{item.sizes},#{item.tab},#{item.rows},#{item.createUser},now(),#{item.bak},${item.geom},#{item.layer},#{item.depcode},#{item.dircode},#{item.ismeta},#{item.sensortype},now(),#{item.resolution},#{item.gridsize},#{item.coorSys},#{item.epsg},#{item.hDatum},#{item.mataType},#{item.bands},#{item.bandType},#{item.ct}) |
| | | (#{item.eventid},#{item.metaid},#{item.verid},#{item.name},#{item.type},#{item.guid},#{item.path},#{item.sizes},#{item.tab},#{item.rows},#{item.createUser},now(),#{item.bak},${item.geom},#{item.layer},#{item.depcode},#{item.dircode},#{item.ismeta},#{item.sensortype},#{item.acqTime},#{item.resolution},#{item.gridsize},#{item.coorSys},#{item.epsg},#{item.hDatum},#{item.mataType},#{item.bands},#{item.bandType},#{item.ct}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | |
| | | |
| | | <update id="update"> |
| | | update lf.sys_meta |
| | | set eventid=#{eventid},metaid=#{metaid},verid=#{verid},name=#{name},type=#{type},guid=#{guid},path=#{path},sizes=#{sizes},tab=#{tab},rows=#{rows},update_user=#{updateUser},update_time=now(),bak=#{bak},geom=${geom},layer=#{layer},depcode=#{depcode},dircode=#{dircode},ismeta=#{ismeta},sensortype=#{sensortype},acq_time=now(),resolution=#{resolution},gridsize=#{gridsize},coor_sys=#{coorSys},epsg=#{epsg},h_datum=#{hDatum},mata_type=#{mataType},bands=#{bands},band_type=#{bandType},ct=#{ct} |
| | | set eventid=#{eventid},metaid=#{metaid},verid=#{verid},name=#{name},type=#{type},guid=#{guid},path=#{path},sizes=#{sizes},tab=#{tab},rows=#{rows},update_user=#{updateUser},update_time=now(),bak=#{bak},geom=${geom},layer=#{layer},depcode=#{depcode},dircode=#{dircode},ismeta=#{ismeta},sensortype=#{sensortype},acq_time=#{acqTime},resolution=#{resolution},gridsize=#{gridsize},coor_sys=#{coorSys},epsg=#{epsg},h_datum=#{hDatum},mata_type=#{mataType},bands=#{bands},band_type=#{bandType},ct=#{ct} |
| | | where id=#{id} |
| | | </update> |
| | | |
| | | <update id="updates"> |
| | | <foreach collection="list" item="item" index="index" separator=";"> |
| | | update lf.sys_meta |
| | | set eventid=#{item.eventid},metaid=#{item.metaid},verid=#{item.verid},name=#{item.name},type=#{item.type},guid=#{item.guid},path=#{item.path},sizes=#{item.sizes},tab=#{item.tab},rows=#{item.rows},update_user=#{item.updateUser},update_time=now(),bak=#{item.bak},geom=${item.geom},layer=#{item.layer},depcode=#{item.depcode},dircode=#{item.dircode},ismeta=#{item.ismeta},sensortype=#{item.sensortype},acq_time=now(),resolution=#{item.resolution},gridsize=#{item.gridsize},coor_sys=#{item.coorSys},epsg=#{item.epsg},h_datum=#{item.hDatum},mata_type=#{item.mataType},bands=#{item.bands},band_type=#{item.bandType},ct=#{item.ct} |
| | | set eventid=#{item.eventid},metaid=#{item.metaid},verid=#{item.verid},name=#{item.name},type=#{item.type},guid=#{item.guid},path=#{item.path},sizes=#{item.sizes},tab=#{item.tab},rows=#{item.rows},update_user=#{item.updateUser},update_time=now(),bak=#{item.bak},geom=${item.geom},layer=#{item.layer},depcode=#{item.depcode},dircode=#{item.dircode},ismeta=#{item.ismeta},sensortype=#{item.sensortype},acq_time=#{item.acqTime},resolution=#{item.resolution},gridsize=#{item.gridsize},coor_sys=#{item.coorSys},epsg=#{item.epsg},h_datum=#{item.hDatum},mata_type=#{item.mataType},bands=#{item.bands},band_type=#{item.bandType},ct=#{item.ct} |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |