我是靠谱客的博主 体贴万宝路,最近开发中收集的这篇文章主要介绍Java发布GeoServer栅格数据Java发布GeoServer栅格数据,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Java发布GeoServer栅格数据

SRS

tiff获取坐标信息

通过geotools读取tiff坐标信息

EPSG:4490

GEOGCS["GCS Name = GCS_China_Geodetic_Coordinate_System_2000", 
  DATUM["Datum = China_2000", 
    SPHEROID["Ellipsoid = CGCS2000", 6378137.0, 298.257222101]], 
  PRIMEM["Greenwich", 0.0], 
  UNIT["degree", 0.017453292519943295], 
  AXIS["Geodetic longitude", EAST], 
  AXIS["Geodetic latitude", NORTH]]

EPSG:4326

GEOGCS["WGS 84", 
  DATUM["World Geodetic System 1984", 
    SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], 
    AUTHORITY["EPSG","6326"]], 
  PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], 
  UNIT["degree", 0.017453292519943295], 
  AXIS["Geodetic longitude", EAST], 
  AXIS["Geodetic latitude", NORTH], 
  AUTHORITY["EPSG","4326"]]

GeoServer-rest接口

coverages.xml

tiff文件上传创建

# 上传tiff后直接发布
http://192.168.1.96:8080/geoserver/rest/workspaces/zrzy_image/coveragestores/test/file.geotiff?configure=first&coverageName=test
# 上传tiff后不发布,等待使用coverages.xml发布
http://192.168.1.96:8080/geoserver/rest/workspaces/zrzy_image/coveragestores/test1/file.geotiff?configure=none
# 上传coverages.xml来创建图层并设置属性
http://192.168.1.96:8080/geoserver/rest/workspaces/zrzy_image/coveragestores/test1/coverages.xml

后台Java使用jdom来操作xml文件,然后使用httpclient上传

当前使用xml
  • 坐标系
  • 输入透明颜色
<coverage>
    <enabled>true</enabled>
    <metadata/>
    <keywords>
        <string>geoTiff</string>
        <string>WCS</string>
    </keywords>
    <metadataLinks/>
    <supportedFormats>
        <string>GEOTIFF</string>
    </supportedFormats>
    <name>test1</name>
    <title>test1</title>
    <srs>EPSG:4490</srs>
    <nativeFormat>GeoTIFF</nativeFormat>
    <nativeCRS>EPSG:4490</nativeCRS>
    <projectionPolicy>FORCE_DECLARED</projectionPolicy>
    <requestSRS>
        <string>EPSG:4490</string>
    </requestSRS>
    <responseSRS>
        <string>EPSG:4490</string>
    </responseSRS>
    <parameters>
    <entry>
      <string>InputTransparentColor</string>
      <string>#000000</string>
    </entry>
  </parameters>
</coverage>
完整coverages.xml文件参考

github参考地址

<coverage>
  <id>CoverageInfoImpl--4a9eec43:132d48aac79:-8000</id>
  <name>mosaic</name>
  <nativeName>mosaic</nativeName>
  <namespace>
    <id>NamespaceInfoImpl--570ae188:124761b8d78:-7ff8</id>
  </namespace>
  <title>mosaic</title>
  <description>Generated from ImageMosaic</description>
  <abstract>Italian sample mosaic</abstract>
  <keywords>
    <string>WCS</string>
    <string>ImageMosaic</string>
    <string>mosaic</string>
  </keywords>
  <nativeCRS>GEOGCS[&quot;WGS 84&quot;, 
  DATUM[&quot;World Geodetic System 1984&quot;, 
    SPHEROID[&quot;WGS 84&quot;, 6378137.0, 298.257223563, AUTHORITY[&quot;EPSG&quot;,&quot;7030&quot;]], 
    AUTHORITY[&quot;EPSG&quot;,&quot;6326&quot;]], 
  PRIMEM[&quot;Greenwich&quot;, 0.0, AUTHORITY[&quot;EPSG&quot;,&quot;8901&quot;]], 
  UNIT[&quot;degree&quot;, 0.017453292519943295], 
  AXIS[&quot;Geodetic longitude&quot;, EAST], 
  AXIS[&quot;Geodetic latitude&quot;, NORTH], 
  AUTHORITY[&quot;EPSG&quot;,&quot;4326&quot;]]</nativeCRS>
  <srs>EPSG:4326</srs>
  <nativeBoundingBox>
    <minx>6.346</minx>
    <maxx>20.83</maxx>
    <miny>36.492</miny>
    <maxy>46.591</maxy>
    <crs>EPSG:4326</crs>
  </nativeBoundingBox>
  <latLonBoundingBox>
    <minx>6.346</minx>
    <maxx>20.83</maxx>
    <miny>36.492</miny>
    <maxy>46.591</maxy>
    <crs>EPSG:4326</crs>
  </latLonBoundingBox>
  <projectionPolicy>REPROJECT_TO_DECLARED</projectionPolicy>
  <enabled>true</enabled>
  <metadata>
    <entry key="dirName">mosaic_mosaic</entry>
  </metadata>
  <store class="coverageStore">
    <id>CoverageStoreInfoImpl--570ae188:124761b8d78:-7fd6</id>
  </store>
  <nativeFormat>ImageMosaic</nativeFormat>
  <grid dimension="2">
    <range>
      <low>0 0</low>
      <high>250 250</high>
    </range>
    <transform>
      <scaleX>0.057934032977228433</scaleX>
      <scaleY>-0.04039598061277999</scaleY>
      <shearX>0.0</shearX>
      <shearY>0.0</shearY>
      <translateX>6.375141924963005</translateX>
      <translateY>46.570568984828704</translateY>
    </transform>
    <crs>EPSG:4326</crs>
  </grid>
  <supportedFormats>
    <string>GIF</string>
    <string>PNG</string>
    <string>JPEG</string>
    <string>TIFF</string>
    <string>ImageMosaic</string>
    <string>GEOTIFF</string>
    <string>ArcGrid</string>
  </supportedFormats>
  <interpolationMethods>
    <string>nearest neighbor</string>
    <string>bilinear</string>
    <string>bicubic</string>
  </interpolationMethods>
  <defaultInterpolationMethod>nearest neighbor</defaultInterpolationMethod>
  <dimensions>
    <coverageDimension>
      <name>RED_BAND</name>
      <description>GridSampleDimension[0.0,0.0]</description>
      <range>
        <min>0.0</min>
        <max>0.0</max>
      </range>
      <nullValues>
        <double>0.0</double>
      </nullValues>
    </coverageDimension>
    <coverageDimension>
      <name>GREEN_BAND</name>
      <description>GridSampleDimension[0.0,0.0]</description>
      <range>
        <min>0.0</min>
        <max>0.0</max>
      </range>
      <nullValues>
        <double>0.0</double>
      </nullValues>
    </coverageDimension>
    <coverageDimension>
      <name>BLUE_BAND</name>
      <description>GridSampleDimension[0.0,0.0]</description>
      <range>
        <min>0.0</min>
        <max>0.0</max>
      </range>
      <nullValues>
        <double>0.0</double>
      </nullValues>
    </coverageDimension>
  </dimensions>
  <requestSRS>
    <string>EPSG:4326</string>
  </requestSRS>
  <responseSRS>
    <string>EPSG:4326</string>
  </responseSRS>
  <parameters>
    <entry>
      <string>BackgroundValues</string>
      <null/>
    </entry>
    <entry>
      <string>Filter</string>
      <null/>
    </entry>
    <entry>
      <string>InputTransparentColor</string>
      <string>#000000</string>
    </entry>
    <entry>
      <string>SUGGESTED_TILE_SIZE</string>
      <string>512,512</string>
    </entry>
    <entry>
      <string>AllowMultithreading</string>
      <string>false</string>
    </entry>
    <entry>
      <string>MaxAllowedTiles</string>
      <string>-1</string>
    </entry>
    <entry>
      <string>OutputTransparentColor</string>
      <string>#000000</string>
    </entry>
    <entry>
      <string>USE_JAI_IMAGEREAD</string>
      <string>true</string>
    </entry>
  </parameters>
</coverage>

最后

以上就是体贴万宝路为你收集整理的Java发布GeoServer栅格数据Java发布GeoServer栅格数据的全部内容,希望文章能够帮你解决Java发布GeoServer栅格数据Java发布GeoServer栅格数据所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(40)

评论列表共有 0 条评论

立即
投稿
返回
顶部