Tabnine Logo
Hints
Code IndexAdd Tabnine to your IDE (free)

How to use
Hints
in
org.geotools.factory

Best Java code snippets using org.geotools.factory.Hints (Showing top 20 results out of 855)

Refine searchRefine arrow

  • Query
  • CRS
  • RenderingHints
  • GeoTools
  • ReferencingFactoryFinder
  • ImageLayout
  • GeneralEnvelope
origin: opentripplanner/OpenTripPlanner

CoordinateReferenceSystem sourceCRS = featureSource.getInfo().getCRS();
Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG",
    hints);
CoordinateReferenceSystem worldCRS = factory
    .createCoordinateReferenceSystem("EPSG:4326");
Query query = new Query();
query.setCoordinateSystem(sourceCRS);
query.setCoordinateSystemReproject(worldCRS);
origin: org.geotools/gt2-jts-wrapper

/**
 * Hints constructor for FactoryRegistry
 */
public JTSAggregateFactory( Hints hints ){
  this( (CoordinateReferenceSystem) hints.get( Hints.CRS ) );
}
/**
origin: stackoverflow.com

File f = new File ( "world.shp" );
 ShapefileDataStore dataStore = new ShapefileDataStore ( f.toURI ().toURL () );
 FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = 
   dataStore.getFeatureSource ();
 String geomAttrName = featureSource.getSchema ()
   .getGeometryDescriptor ().getLocalName ();
 ResourceInfo resourceInfo = featureSource.getInfo ();
 CoordinateReferenceSystem crs = resourceInfo.getCRS ();
 Hints hints = GeoTools.getDefaultHints ();
 hints.put ( Hints.JTS_SRID, 4326 );
 hints.put ( Hints.CRS, crs );
 FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2 ( hints );
 GeometryFactory gf = JTSFactoryFinder.getGeometryFactory ( hints );
 Coordinate land = new Coordinate ( -122.0087, 47.54650 );
 Point pointLand = gf.createPoint ( land );
 Coordinate water = new Coordinate ( 0, 0 );
 Point pointWater = gf.createPoint ( water );
 Intersects filter = ff.intersects ( ff.property ( geomAttrName ), 
   ff.literal ( pointLand ) );
 FeatureCollection<SimpleFeatureType, SimpleFeature> features = featureSource
     .getFeatures ( filter );
 filter = ff.intersects ( ff.property ( geomAttrName ), 
   ff.literal ( pointWater ) );
 features = featureSource.getFeatures ( filter );
origin: org.geotools/gt2-metadata

/**
 * Adds all specified hints to the system hints. This
 * is for {@link GeoTools#init} implementation only.
 */
static void putSystemDefault(final RenderingHints hints) {
  synchronized (GLOBAL) {
    ensureSystemDefaultLoaded();
    GLOBAL.add(hints);
  }
  GeoTools.fireConfigurationChanged();
}
origin: org.geotools/gt2-coverage

  sameCRS = CRS.equalsIgnoreMetadata(targetCRS, sourceCRS);
  if (sameGG && sameCRS) {
    return sourceCoverage;
  targetHints = new RenderingHints(hints);
} else if (hints != null) {
  targetHints.add(hints);
  final Object property = (hints != null) ? hints.get(Hints.JAI_INSTANCE) : null;
  if (property instanceof JAI) {
    processor = (JAI) property;
    ReferencingFactoryFinder.getCoordinateOperationFactory(hints);
final MathTransformFactory mtFactory =
    ReferencingFactoryFinder.getMathTransformFactory(hints);
      gridRange = CRS.transform(allSteps.inverse(), gridRange);
      targetGG  = new GridGeometry2D(new GeneralGridRange(gridRange), step1, targetCRS);
  step3          = sourceGG.getGridToCRS().inverse();
  sourceEnvelope = sourceCoverage.getEnvelope();
  targetEnvelope = CRS.transform(step2.inverse(), sourceEnvelope);
  targetEnvelope.setCoordinateReferenceSystem(targetCRS);
      for (int i=gridRange.getDimension(); --i>=0;) {
        gridRange.setRange(i, gridRange.getMinimum(i) + 0.5,
origin: org.geotools/gt-coverage

    if(!CRS.equalsIgnoreMetadata(targetCRS, targetGGCRS)&&!CRS.findMathTransform(targetCRS, targetGGCRS).isIdentity()){
      throw new IllegalArgumentException(Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$1,"TargetCRS must be compatible with TargetGG CRS"));
    if(hints.containsKey(JAI.KEY_INTERPOLATION))
        interpolation=(Interpolation) hints.get(JAI.KEY_INTERPOLATION);
  hints.put(JAI.KEY_INTERPOLATION,interpolation);
if (!hints.containsKey(JAI.KEY_BORDER_EXTENDER)) {
  hints.put(JAI.KEY_BORDER_EXTENDER, BorderExtender.createInstance(BorderExtender.BORDER_COPY));
if (CRS.equalsIgnoreMetadata(sourceCRS, targetCRS)) {
  targetEnvelope.setCoordinateReferenceSystem(targetCRS);
  targetHints.add(hints);
ImageLayout layout = (ImageLayout) targetHints.get(JAI.KEY_IMAGE_LAYOUT);
if (layout != null) {
  layout = (ImageLayout) layout.clone();
} else {
  layout = new ImageLayout();
final Rectangle targetBB = targetGG.getGridRange2D();
if (isBoundsUndefined(layout, false)) {
  layout.setMinX  (targetBB.x);
targetHints.put(JAI.KEY_IMAGE_LAYOUT, layout);
origin: org.geotools/gt-render

final MathTransform sourceCRSToDestinationCRSTransformation = CRS.findMathTransform(sourceCoverageCRS, destinationCRS, true);
final MathTransform destinationCRSToSourceCRSTransformation = sourceCRSToDestinationCRSTransformation.inverse();
final boolean doReprojection = !sourceCRSToDestinationCRSTransformation.isIdentity();
    destinationEnvelopeInSourceCRS = CRS.transform(
        destinationCRSToSourceCRSTransformation,
        destinationEnvelope);
    if (!CRS.equalsIgnoreMetadata(destinationCRS,
        DefaultGeographicCRS.WGS84)) {
            destinationEnvelope);
        destinationEnvelopeWGS84
            .setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
      } else {
        destinationEnvelopeWGS84 = new GeneralEnvelope(
            destinationEnvelope);
      destinationEnvelopeWGS84 = new GeneralEnvelope(
          destinationEnvelope);
final Interpolation interpolation = (Interpolation) hints.get(JAI.KEY_INTERPOLATION);
if (LOGGER.isLoggable(Level.FINE))
  LOGGER.fine("Using interpolation "+interpolation);
final Hints localHints = this.hints.clone();
if(interpolation instanceof InterpolationNearest){
  localHints.add(new RenderingHints(JAI.KEY_REPLACE_INDEX_COLOR_MODEL, Boolean.FALSE));
  localHints.add(new RenderingHints(JAI.KEY_TRANSFORM_ON_COLORMAP, Boolean.TRUE));
origin: org.geotools/gt-imagemosaic

final Rectangle sourceArea = CRS.transform(cropWorldToGrid, intersection).toRectangle2D().getBounds();
    final ImageLayout layout = new ImageLayout();
    layout.setTileHeight(tileDimensions.width).setTileWidth(tileDimensions.height);
    localHints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT,layout));
  } else {
    if (hints != null && hints.containsKey(JAI.KEY_IMAGE_LAYOUT)) {
          final Object layout = hints.get(JAI.KEY_IMAGE_LAYOUT);
          if (layout != null && layout instanceof ImageLayout) {
            localHints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, ((ImageLayout) layout).clone()));
  if (hints != null && hints.containsKey(JAI.KEY_TILE_CACHE)){
    final Object cache = hints.get(JAI.KEY_TILE_CACHE);
    if (cache != null && cache instanceof TileCache)
      localHints.add(new RenderingHints(JAI.KEY_TILE_CACHE, (TileCache) cache));
  if (hints != null && hints.containsKey(JAI.KEY_TILE_SCHEDULER)){
            final Object scheduler = hints.get(JAI.KEY_TILE_SCHEDULER);
            if (scheduler != null && scheduler instanceof TileScheduler)
              localHints.add(new RenderingHints(JAI.KEY_TILE_SCHEDULER, (TileScheduler) scheduler));
  if (hints != null && hints.containsKey(JAI.KEY_BORDER_EXTENDER)) {
    final Object extender = hints.get(JAI.KEY_BORDER_EXTENDER);
    if (extender != null && extender instanceof BorderExtender) {
      localHints.add(new RenderingHints(JAI.KEY_BORDER_EXTENDER, (BorderExtender) extender));
origin: org.geoserver.community/importer-core

public GeoToolsCoverageTransformer(String defaultSRS) {
  // create basic hints
  hints = new Hints(GeoTools.getDefaultHints());
  if (defaultSRS != null) {
    try {
      final CoordinateReferenceSystem crs = CRS.decode(defaultSRS);
      hints.add(new RenderingHints(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM, crs));
    } catch (Exception e) {
      LOGGER.log(Level.FINE, "Cannot parse CRS " + defaultSRS, new Exception());
      hints = new Hints(GeoTools.getDefaultHints());
    }
  }
}
origin: org.geotools/gt-imagemosaic

this.granuleDescriptor = granuleDescriptor;
this.request=request;
this.hints = new Hints(hints);
if (request.getTileDimensions()!= null) {
  final Dimension tileDimension = request.getTileDimensions();
  if (hints != null && hints.containsKey(JAI.KEY_IMAGE_LAYOUT)){
    final Object layout = this.hints.get(JAI.KEY_IMAGE_LAYOUT);
    if (layout != null && layout instanceof ImageLayout){
      final ImageLayout imageLayout = (ImageLayout) layout;
      imageLayout.setTileHeight(tileDimension.height);
      imageLayout.setTileWidth(tileDimension.width);
    final ImageLayout layout = new ImageLayout();
    layout.setTileWidth(tileDimension.width).setTileHeight(tileDimension.height);
    this.hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT,layout));
origin: org.geotools/gt-geotiff

    if (name.equals(AbstractGridFormat.READ_GRIDGEOMETRY2D.getName())) {
      final GridGeometry2D gg = (GridGeometry2D) param.getValue();
      requestedEnvelope = new GeneralEnvelope((Envelope) gg.getEnvelope2D());
      dim = gg.getGridRange2D().getBounds();
      continue;
newHints= (Hints) hints.clone();
    final ImageLayout layout = new ImageLayout();
    layout.setTileGridXOffset(0);
    layout.setTileGridYOffset(0);
    layout.setTileHeight(suggestedTileSize[1]);
    layout.setTileWidth(suggestedTileSize[0]);
    newHints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout));
origin: org.geotools/gt-imagemosaic

final ImageLayout layout = new ImageLayout(
    rasterBounds.x,
    rasterBounds.y,
        layout.setTileHeight(tileDimensions.width).setTileWidth(tileDimensions.height);
    final RenderingHints localHints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT,layout);
    if (hints != null && !hints.isEmpty()){
      if (hints.containsKey(JAI.KEY_TILE_CACHE)){
        final Object tc = hints.get(JAI.KEY_TILE_CACHE);
        if (tc != null && tc instanceof TileCache)
          localHints.add(new RenderingHints(JAI.KEY_TILE_CACHE, (TileCache) tc));
      if (hints != null && hints.containsKey(JAI.KEY_BORDER_EXTENDER)){
        final Object extender = hints.get(JAI.KEY_BORDER_EXTENDER);
        if (extender != null && extender instanceof BorderExtender) {
          localHints.add(new RenderingHints(JAI.KEY_BORDER_EXTENDER, (BorderExtender) extender));
        localHints.add(ImageUtilities.BORDER_EXTENDER_HINTS);
      if (hints.containsKey(JAI.KEY_TILE_SCHEDULER)){
        final Object ts = hints.get(JAI.KEY_TILE_SCHEDULER);
        if (ts != null && ts instanceof TileScheduler)
          localHints.add(new RenderingHints(JAI.KEY_TILE_SCHEDULER, (TileScheduler) ts));
origin: org.geotools/gt-render

final Hints hints = new Hints(getHints());
final ImageLayout layout = new ImageLayout();
final RenderedImage sourceRaster = source
    .getRenderedImage();
    .getInstance(ColorSpace.CS_GRAY), false, false,
    Transparency.OPAQUE, oldSM.getDataType());
layout.setColorModel(cm);
layout.setSampleModel(cm.createCompatibleSampleModel(oldSM
    .getWidth(), oldSM.getHeight()));
hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout));
output = (GridCoverage2D) new SelectSampleDimension()
    .doOperation(parameters, hints);
origin: org.geotools/gt-imageio-ext-gdal

final Object tempCRS = this.hints.get(Hints.DEFAULT_COORDINATE_REFERENCE_SYSTEM);
if (tempCRS != null) {
  this.crs=(CoordinateReferenceSystem) tempCRS;
        this.crs=CRS.parseWKT(wkt);
        final Integer epsgCode = CRS.lookupEpsgCode(this.crs, true);
          this.crs=CRS.decode("EPSG:" + epsgCode);
        this.originalEnvelope=CRS.transform(ProjectiveTransform
            .create(tempTransform), new GeneralEnvelope(
                ((GridEnvelope2D) this.originalGridRange)));
      } catch (IllegalStateException e) {
origin: org.geotools/gt2-coverage

if (!CRS.equalsIgnoreMetadata(sourceCRS, destinationCRS)) {
  throw new CannotCropException(Errors.format(
      ErrorKeys.MISMATCHED_ENVELOPE_CRS_$2, sourceCRS.getName()
final GeneralEnvelope intersectionEnvelope = new GeneralEnvelope(
    (Envelope) destinationEnvelope);
intersectionEnvelope.setCoordinateReferenceSystem(source
    .getCoordinateReferenceSystem());
intersectionEnvelope.intersect(sourceEnvelope);
if (intersectionEnvelope.isEmpty())
  throw new CannotCropException(Errors
      .create(parameters,
          (hints instanceof Hints) ? (Hints) hints
              : new Hints(hints), source,
          sourceGridToWorld, tolerance);
} else {
origin: org.geotools/gt2-render

final MathTransform sourceCRSToDestinationCRSTransformation = CRS.findMathTransform(sourceCoverageCRS, destinationCRS, true);
final MathTransform destinationCRSToSourceCRSTransformation = sourceCRSToDestinationCRSTransformation.inverse();
final boolean doReprojection = !sourceCRSToDestinationCRSTransformation.isIdentity();
    destinationEnvelopeInSourceCRS = CRS.transform(
        destinationCRSToSourceCRSTransformation,
        destinationEnvelope);
    if (!CRS.equalsIgnoreMetadata(destinationCRS,
        DefaultGeographicCRS.WGS84)) {
            destinationEnvelope);
        destinationEnvelopeWGS84
            .setCoordinateReferenceSystem(DefaultGeographicCRS.WGS84);
      } else {
        destinationEnvelopeWGS84 = new GeneralEnvelope(
            destinationEnvelope);
      destinationEnvelopeWGS84 = new GeneralEnvelope(
          destinationEnvelope);
    .get(JAI.KEY_INTERPOLATION);
if (LOGGER.isLoggable(Level.FINE))
  LOGGER.fine(new StringBuffer("Using interpolation ").append(
origin: locationtech/geogig

private FeatureReader<SimpleFeatureType, SimpleFeature> getReader(Query query) {
  GeometryFactory geometryFactory = (GeometryFactory) query.getHints()
      .get(Hints.JTS_GEOMETRY_FACTORY);
  Integer offset = query.getStartIndex();
  Integer limit = query.isMaxFeaturesUnlimited() ? null : query.getMaxFeatures();
  String[] propertyNames = query.getPropertyNames();
  ScreenMap screenMap = (ScreenMap) query.getHints().get(Hints.SCREENMAP);
  SortBy[] sortBy = query.getSortBy();
  reader = builder.filter(query.getFilter())//
      .geometryFactory(geometryFactory)//
      .offset(offset)//
      .limit(limit)//
      .propertyNames(propertyNames)//
      .screenMap(screenMap)//
      .sortBy(sortBy)//
      .build();
  return reader;
}
origin: codice/ddf

/**
 * Transform a geometry to EPSG:4326 format with lon/lat coordinate ordering. NOTE: This method
 * will perform the transform swapping coordinates even if the sourceCrsName is EPSG:4326
 *
 * @param geometry - Geometry to transform
 * @param sourceCrsName - Source geometry's coordinate reference system
 * @return Geometry - Transformed geometry into EPSG:4326 lon/lat coordinate system
 */
public static Geometry transformToEPSG4326LonLatFormat(Geometry geometry, String sourceCrsName)
  throws GeoFormatException {
 if (geometry == null) {
  throw new GeoFormatException("Unable to convert null geometry");
 }
 // If we don't have source CRS just return geometry as we can't transform without that
 // information
 if (sourceCrsName == null) {
  return geometry;
 }
 try {
  CoordinateReferenceSystem sourceCrs = CRS.decode(sourceCrsName);
  Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
  CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", hints);
  CoordinateReferenceSystem targetCRS = factory.createCoordinateReferenceSystem(EPSG_4326);
  MathTransform transform = CRS.findMathTransform(sourceCrs, targetCRS);
  return JTS.transform(geometry, transform);
 } catch (FactoryException | TransformException e) {
  throw new GeoFormatException("Unable to convert coordinate to " + EPSG_4326, e);
 }
}
origin: org.geoserver/wms

FilterFactory2 filterFac = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
      if ((requestedCRS != null) && !CRS.equalsIgnoreMetadata(dataCRS, requestedCRS)) {
        try {
          MathTransform transform = CRS.findMathTransform(requestedCRS, dataCRS, true);
      final CoverageInfo cinfo = requestedLayers[i].getCoverage();
      final GridGeometry2D coverageGeometry=(GridGeometry2D) cinfo.getGrid();
      final GeneralEnvelope requestedEnvelope=new GeneralEnvelope(new ReferencedEnvelope(bbox,requestedCRS));
      final GridCoverage2D coverage=(GridCoverage2D) cinfo.getCoverage(requestedEnvelope, new Rectangle(0,0,width,height));
      final DirectPosition position = new DirectPosition2D(requestedCRS, middle.x, middle.y);
              requestedCRS, targetCRS, new Hints(
                  Hints.LENIENT_DATUM_SHIFT,
                  Boolean.TRUE));
origin: org.geotools/gt-render

        currentSourceCoverage.getRenderedImage()
            .getSampleModel().getDataType());
    layout = new ImageLayout();
    layout.setColorModel(cm);
  } else if (!gg.equals(gridGeometry))
    throw new IllegalArgumentException(Errors.format(
  hints.add(new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout));
op = FormatDescriptor.create(op, Integer.valueOf(op.getSampleModel().getDataType()), hints);
final GridSampleDimension [] sd= new GridSampleDimension[op.getSampleModel().getNumBands()];
org.geotools.factoryHints

Javadoc

A set of hints providing control on factories to be used. Those hints are typically used by renderers or org.opengis.coverage.processing.GridCoverageProcessor for example. They provides a way to control low-level details. Example:

 
CoordinateOperationFactory myFactory = &hellip 
Hints hints = new Hints(Hints. 
#COORDINATE_OPERATION_FACTORY, myFactory); 
AbstractProcessor processor = new DefaultProcessor(hints); 

Any hint mentioned by this class is considered to be API, failure to make use of a hint by a GeoTools factory implementation is considered a bug (as it will prevent the use of this library for application specific tasks).

When hints are used in conjuction with the FactoryRegistry we have the complete geotools plugin system. By using hints to allow application code to effect service discovery we allow client code to retarget the geotools library for their needs.

Most used methods

  • <init>
    Constructs a new object with keys and values initialized from the specified map (which may be null).
  • get
  • put
  • add
  • containsKey
  • remove
  • putSystemDefault
    Adds all specified hints to the system hints. This is for GeoTools#init implementation only.
  • clone
    Returns a new map of hints with the same content than this map.
  • getSystemDefault
    Returns the hint GeoTools#getDefaultHintsfor the specified key.
  • isEmpty
  • putAll
  • ensureSystemDefaultLoaded
    Invokes GeoTools#scanSystemProperties when first needed. The caller is responsible for invoking GeoT
  • putAll,
  • ensureSystemDefaultLoaded,
  • fromPairs,
  • getDefaults,
  • keySet,
  • stripNonKeys,
  • getList,
  • getStack,
  • nameOf,
  • removeSystemDefault

Popular in Java

  • Creating JSON documents from java classes using gson
  • getContentResolver (Context)
  • scheduleAtFixedRate (Timer)
  • runOnUiThread (Activity)
  • Menu (java.awt)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JCheckBox (javax.swing)
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now