@@ -20,17 +20,16 @@ import geotrellis.proj4.CRS
2020import geotrellis .raster ._
2121import geotrellis .raster .io .geotiff .util ._
2222import geotrellis .vector .Extent
23-
2423import it .geosolutions .imageio .utilities .ImageIOUtilities
2524import org .geotools .coverage .Category
2625import org .geotools .coverage .GridSampleDimension
2726import org .geotools .coverage .grid ._
28- import org .geotools .geometry .Envelope2D
2927import org .geotools .referencing .{CRS => GeoToolsCRS }
3028import org .geotools .coverage .util .CoverageUtilities
3129import org .geotools .util .NumberRange
32- import org .opengis .coverage .SampleDimensionType
33- import org .opengis .referencing .crs .CoordinateReferenceSystem
30+ import org .geotools .geometry .jts .ReferencedEnvelope
31+ import org .geotools .api .coverage ._
32+ import org .geotools .api .referencing .crs .CoordinateReferenceSystem
3433import spire .syntax .cfor ._
3534
3635import java .awt .Color
@@ -198,18 +197,18 @@ object GridCoverage2DConverters {
198197 }
199198
200199 /**
201- * A function to produce a GeoTools Envelope2D from a Geotrellis
200+ * A function to produce a GeoTools ReferencedEnvelope from a Geotrellis
202201 * Extent and CRS.
203202 *
204203 * @param extent The Geotrellis Extent
205204 * @param crs The CRS of the raster
206205 *
207- * @return A GeoTools Envelope2D
206+ * @return A GeoTools ReferencedEnvelope
208207 */
209- def getEnvelope2D (extent : Extent ): Envelope2D = {
208+ def getEnvelope2D (extent : Extent ): ReferencedEnvelope = {
210209 val Extent (xmin, ymin, xmax, ymax) = extent
211210
212- new Envelope2D ( null , xmin, ymin, ( xmax - xmin), ( ymax - ymin) )
211+ ReferencedEnvelope .rect( xmin, ymin, xmax - xmin, ymax - ymin, null )
213212 }
214213
215214 def getGeotoolsCRS (crs : CRS ): CoordinateReferenceSystem = {
@@ -222,20 +221,20 @@ object GridCoverage2DConverters {
222221 }
223222
224223 /**
225- * A function to produce a GeoTools Envelope2D from a Geotrellis
224+ * A function to produce a GeoTools ReferencedEnvelope from a Geotrellis
226225 * Extent and CRS. If the CRS cannot be converted, a null GeoTools
227226 * CRS is used.
228227 *
229228 * @param extent The Geotrellis Extent
230229 * @param crs The CRS of the raster
231230 *
232- * @return A GeoTools Envelope2D
231+ * @return A GeoTools ReferencedEnvelope
233232 */
234- def getEnvelope2D (extent : Extent , crs : CRS ): Envelope2D = {
233+ def getEnvelope2D (extent : Extent , crs : CRS ): ReferencedEnvelope = {
235234 val Extent (xmin, ymin, xmax, ymax) = extent
236235 val geoToolsCRS = getGeotoolsCRS(crs)
237236
238- new Envelope2D (geoToolsCRS, xmin, ymin, ( xmax - xmin), ( ymax - ymin) )
237+ ReferencedEnvelope .rect( xmin, ymin, xmax - xmin, ymax - ymin, geoToolsCRS )
239238 }
240239
241240 def getValueRange (cellType : CellType ): (Double , Double ) =
0 commit comments