当前位置: 首页>>代码示例>>Java>>正文


Java MismatchedDimensionException类代码示例

本文整理汇总了Java中org.opengis.geometry.MismatchedDimensionException的典型用法代码示例。如果您正苦于以下问题:Java MismatchedDimensionException类的具体用法?Java MismatchedDimensionException怎么用?Java MismatchedDimensionException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MismatchedDimensionException类属于org.opengis.geometry包,在下文中一共展示了MismatchedDimensionException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFilterFromParameters

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
/**
 * Gets the filter from parameters.
 *
 * @param wifParameters
 *          the wif parameters
 * @return the filter from parameters
 * @throws MismatchedDimensionException
 *           the mismatched dimension exception
 * @throws TransformException
 *           the transform exception
 * @throws NoSuchAuthorityCodeException
 *           the no such authority code exception
 * @throws FactoryException
 *           the factory exception
 * @throws ParseException
 *           the parse exception
 * @throws CQLException
 *           the cQL exception
 */
public Filter getFilterFromParameters(final Map<String, Object> wifParameters)
    throws MismatchedDimensionException, TransformException,
    NoSuchAuthorityCodeException, FactoryException, ParseException,
    CQLException {
  LOGGER.debug("getFilterFromParameters...");

  String queryTxt = "";

  final String polyTxt = getIntersectionPolygon(wifParameters);

  if (polyTxt == null) {
    LOGGER
    .info("no polygon query filter received, defaulting to including all the unified area zone!");
    queryTxt = "include";
  } else if (polyTxt.equals("")) {
    LOGGER
    .info("no polygon query filter received, defaulting to including all the unified area zone!");
    queryTxt = "include";
  } else {
    queryTxt = polyTxt;
  }
  LOGGER.debug("query filter: {}", queryTxt);
  return getFilter(queryTxt);
}
 
开发者ID:AURIN,项目名称:online-whatif,代码行数:44,代码来源:GeodataFilterer.java

示例2: calculateLayerScale

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
private double calculateLayerScale(Crs mapCrs, Crs layerCrs, Bbox mapBounds, double mapScale)
		throws GeomajasException {
	double layerScale = mapScale;

	try {
		// We don't necessarily need to split into same CRS and different CRS cases, the latter implementation uses
		// identity transform if CRSs are equal for map and layer but might introduce bugs in rounding and/or
		// conversions.
		if (!mapCrs.equals(layerCrs)) {

			// Translate the map coordinates to layer coordinates, assumes equal x-y orientation
			Bbox layerBounds = geoService.transform(mapBounds, mapCrs, layerCrs);
			layerScale = mapBounds.getWidth() * mapScale / layerBounds.getWidth();
		}
	} catch (MismatchedDimensionException e) {
		throw new GeomajasException(e, ExceptionCode.RENDER_DIMENSION_MISMATCH);
	}
	return layerScale;
}
 
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:20,代码来源:SearchByPointCommand.java

示例3: updateLayerGroup

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
void updateLayerGroup(LayerGroupInfo lgi, ReferencedEnvelope dirtyRegion) {
    log.fine(()->"Updating bounds of "+lgi.prefixedName()+" in response to data change");
    ReferencedEnvelope bounds = lgi.getBounds();
    try {
        bounds.expandToInclude(new ReferencedEnvelope(dirtyRegion).transform(bounds.getCoordinateReferenceSystem(), true, 1000));
    } catch (MismatchedDimensionException | TransformException | FactoryException ex) {
        log.log(Level.WARNING, "Error while transforming changes to coordinate system of layer group "+lgi.prefixedName(), ex);
    }
    lgi.setBounds(bounds);
    catalog.save(lgi);
}
 
开发者ID:MapStory,项目名称:ms-gs-plugins,代码行数:12,代码来源:BoundsUpdateTransactionListener.java

示例4: eastNorthToLatLong

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
public static Coordinate eastNorthToLatLong(double x, double y, String sourceCrs, String targetCrs) throws FactoryException, MismatchedDimensionException, TransformException {
    CoordinateReferenceSystem targetCrsDecoded = CRS.decode(targetCrs);
    CoordinateReferenceSystem sourceCrsDecoded = CRS.decode(sourceCrs);

    CoordinateOperation op = new DefaultCoordinateOperationFactory().createOperation(sourceCrsDecoded, targetCrsDecoded);

    DirectPosition source = new GeneralDirectPosition(x, y);
    DirectPosition target = op.getMathTransform().transform(source, null);
    Double targetX = target.getOrdinate(0);
    Double targetY = target.getOrdinate(1);

    return new Coordinate(targetY, targetX);
}
 
开发者ID:FutureCitiesCatapult,项目名称:TomboloDigitalConnector,代码行数:14,代码来源:CoordinateUtils.java

示例5: convertUTM_MGA942Geographic_EPSG4326

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
public static Geometry convertUTM_MGA942Geographic_EPSG4326(Double easting, Double northing, String zone) throws NoSuchAuthorityCodeException, FactoryException, MismatchedDimensionException, TransformException{
	CoordinateReferenceSystem geographic = CRS.decode("EPSG:4326", false);
	CoordinateReferenceSystem geographic2 = ReferencingFactoryFinder.getCRSAuthorityFactory(
			"EPSG", null).createCoordinateReferenceSystem("4326");
	

	
	CoordinateReferenceSystem utm = ReferencingFactoryFinder.getCRSAuthorityFactory(
			"EPSG", null).createCoordinateReferenceSystem("283"+zone);
	
	CoordinateOperationFactory coFactory = ReferencingFactoryFinder
			.getCoordinateOperationFactory(null);
	
	CoordinateReferenceSystem sourceCRS = utm;		
	CoordinateReferenceSystem targetCRS = geographic;

	GeometryFactory gf = new GeometryFactory();
       Coordinate coord = new Coordinate( easting, northing );
       Point point = gf.createPoint( coord );
       
	
	MathTransform mathTransform =CRS.findMathTransform( sourceCRS, targetCRS,true );
	Geometry g2 = JTS.transform(point, mathTransform);
	
	//VT: Flip around to correct the lat lon from the utm to geographic transformation
	Coordinate[] original = g2.getCoordinates();
	for(int i = 0; i < original.length; i++){
	    Double swapValue = original[i].x;
	    original[i].x = original[i].y;
	    original[i].y = swapValue;
	}
    
	return g2;
}
 
开发者ID:AuScope,项目名称:igsn30,代码行数:35,代码来源:SpatialUtilities.java

示例6: main

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
public static void main(String [] args) throws NoSuchAuthorityCodeException, FactoryRegistryException, FactoryException, MismatchedDimensionException, TransformException{

		
		String zone = "52";
		double easting =596450.153;
		double northing = 6680793.777;
		System.out.print(SpatialUtilities.convertUTM_MGA942Geographic_EPSG4326(easting, northing, zone));
		
//		String zone = "53";
//		double easting =616450.153;
//		double northing = 6680793.777;
//		System.out.print(SpatialUtilities.convertUTM_MGA942Geographic_EPSG4326(easting, northing, zone));
		
	}
 
开发者ID:AuScope,项目名称:igsn30,代码行数:15,代码来源:TEST.java

示例7: process

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
@Override
public void process(NodeContainer nodec) {
    Node node = nodec.getEntity();
    double lat = node.getLatitude();
    double lon = node.getLongitude();

    // Transform to EPSG:3067
    DirectPosition2D ptDst = new DirectPosition2D(targetCRS);
    try {
        transform.transform(new DirectPosition2D(sourceCRS, lon, lat), ptDst);

        String tm35MapSheet = TM35Utils.reverseGeocode(ptDst.x, ptDst.y, TM35Scale.SCALE_10000);

        GridCoverage2D gc = ready.get(tm35MapSheet);

        if (gc != null) {
            // Do the computation
            processReady(gc, ptDst, node);
        } else {
            // Download tiff async

            processing.compute(tm35MapSheet, (sheetKey, currentSet) -> {
                if (currentSet == null)
                    currentSet = new HashSet<>();

                currentSet.add(new TranslatedNode(node, ptDst));
                return currentSet;
            });
            submitTiffQuerying(tm35MapSheet);
        }
        processReadyItems();

    } catch (MismatchedDimensionException | TransformException e) {
        LOGGER.log(Level.WARNING,
                "Could not transform lat=" + lat + ", lon=" + lon + " from " + sourceCRS + " to " + targetCRS, e);
    }
}
 
开发者ID:jsimomaa,项目名称:osmosis-nls-dem,代码行数:38,代码来源:NLSDEMTask.java

示例8: getWMSOutcome

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
@Override
public Boolean getWMSOutcome(final String id, final String areaAnalyzed, final String crsArea)
    throws WifInvalidInputException, WifInvalidConfigException,
    MismatchedDimensionException, NoSuchAuthorityCodeException,
    FactoryException, TransformException, ParseException, IOException,
    CQLException, SuitabilityAnalysisFailedException, ParsingException {
  final SuitabilityScenario suitabilityScenario = getSuitabilityScenario(id);
  return suitabilityAnalyzer.doSuitabilityAnalysisWMS(suitabilityScenario,
      areaAnalyzed, crsArea);
}
 
开发者ID:AURIN,项目名称:online-whatif,代码行数:11,代码来源:SuitabilityScenarioServiceImpl.java

示例9: getOutcome

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
@Override
public SimpleFeatureCollection getOutcome(final String id, final String areaAnalyzed,
    final String crsArea) throws WifInvalidInputException,
WifInvalidConfigException, MismatchedDimensionException,
NoSuchAuthorityCodeException, CQLException, FactoryException,
TransformException, ParseException, ParsingException,
DatabaseFailedException {
  final SuitabilityScenario suitabilityScenario = getSuitabilityScenario(id);
  return suitabilityAnalyzer.doSuitabilityAnalysis(suitabilityScenario,
      areaAnalyzed, crsArea);
}
 
开发者ID:AURIN,项目名称:online-whatif,代码行数:12,代码来源:SuitabilityScenarioServiceImpl.java

示例10: renderGridButtonActionPerformed

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
private void renderGridButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renderGridButtonActionPerformed
    // render watershed, points and dummy grid .. change the size of the dummy grid based on the points.
    gridMaker = new GridMaker(is);
    gridMaker.addCentersBuiltEventListener(this);
    System.out.println("is = " + is);
    try {
        gridMaker.displayShapeFile();
    } catch (IOException | FactoryException | MismatchedDimensionException | TransformException ex) {
        Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex);
        appendToMessage(ex.getMessage(), true);
    }
}
 
开发者ID:skp703,项目名称:RainInterpolator,代码行数:13,代码来源:MainGUI.java

示例11: testCrop

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
@Test
public void testCrop() throws MismatchedDimensionException, NoSuchAuthorityCodeException, FactoryException {
    float[][] grid = new float[][] {{3,4},{1,2}};
    final GridCoverageFactory coverageFactory = CoverageFactoryFinder.getGridCoverageFactory(GeoTools.getDefaultHints());
    final GridCoverage2D coverage = coverageFactory.create("geohashGridAgg", grid, new ReferencedEnvelope(0,20,0,20,null));
    final ReferencedEnvelope envelope = new ReferencedEnvelope(10,20,10,20,null);
    final GridCoverage2D croppedCoverage = GridCoverageUtil.crop(coverage, envelope);
    final RenderedImage renderedImage = croppedCoverage.getRenderedImage();
    assertEquals(1, renderedImage.getWidth());
    assertEquals(1, renderedImage.getHeight());
    assertEquals(4, croppedCoverage.evaluate(new Point2D.Double(15,15), new float[1])[0], 1e-10);
}
 
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:13,代码来源:GridCoverageUtilTest.java

示例12: projectGeometry

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
/**
 * Project geometry.
 *
 * @param originalGeom
 *            the original geom
 * @param srcCRSCode
 *            the src crs code
 * @param trgCRSCode
 *            the trg crs code
 * @return the geometry
 * @throws NoSuchAuthorityCodeException
 *             the no such authority code exception
 * @throws FactoryException
 *             the factory exception
 * @throws MismatchedDimensionException
 *             the mismatched dimension exception
 * @throws TransformException
 *             the transform exception
 */
public static Geometry projectGeometry(Geometry originalGeom, String srcCRSCode,
    String trgCRSCode) throws NoSuchAuthorityCodeException, FactoryException, MismatchedDimensionException,
    TransformException
{

    Geometry projectedGeometry = null;
    final MathTransform transform = CRS.findMathTransform(CRS.decode(srcCRSCode, true), CRS.decode(trgCRSCode, true), true);

    // converting geometries into a linear system
    try
    {
        projectedGeometry = JTS.transform(originalGeom, transform);
    }
    catch (Exception e)
    {
        GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(
                    PrecisionModel.FLOATING), 4326);
        WKTReader reader = new WKTReader(geometryFactory);

        try
        {
            Polygon worldCutPolygon = (Polygon) reader.read("POLYGON((-180 -89.9, -180 89.9, 180 89.9, 180 -89.9, -180 -89.9))");

            projectedGeometry = JTS.transform(originalGeom.intersection(worldCutPolygon),
                    transform);
        }
        catch (Exception ex)
        {
            throw new RuntimeException(ex);
        }
    }

    return projectedGeometry;
}
 
开发者ID:geoserver,项目名称:geofence,代码行数:54,代码来源:GeometryUtility.java

示例13: transformCoordinateSet

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
private ErgoCoordinateSet transformCoordinateSet(ErgoReferenceSystem sourceCRS, ErgoReferenceSystem targetCRS) {
	double C1;
	double C2;

	if (sourceCRS.getType().equalsIgnoreCase(GEOGRAPHIC)) {
		C1 = y.doubleValue();
		C2 = x.doubleValue();
	} else {
		C1 = x.doubleValue();
		C2 = y.doubleValue();
	}

	Coordinate coordinateSet = new Coordinate(C1,C2);
	ErgoCoordinateSet targetCoordinateSet = new ErgoCoordinateSet(0, 0, 0, null);
	ErgoCoordinateSet sourceCoordinateSet = new ErgoCoordinateSet(C1, C2, 0, sourceCRS.getSystem());
	boolean leniency = true;
	if (sourceCRS != targetCRS) {
		try {
			targetCoordinateSet = TransformReferenceSystem.TransformCoordinates(coordinateSet, sourceCRS.getSystem(), targetCRS.getSystem(), leniency);

		} catch (MismatchedDimensionException | FactoryException | TransformException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return targetCoordinateSet;
	} else {
		return sourceCoordinateSet;
	}
}
 
开发者ID:MikeFot,项目名称:Java--GIS-Shapefile-Parser-and-Processor,代码行数:31,代码来源:ErgoVertex.java

示例14: calculateDistance

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
private double calculateDistance(Geometry g1, Geometry g2)
		throws NoSuchAuthorityCodeException, FactoryException,
		MismatchedDimensionException, TransformException {
	Point c1 = g1.getCentroid();
	Point c2 = g2.getCentroid();

	Coordinate[] coordinates = new Coordinate[2];
	coordinates[0] = c1.getCoordinate();
	coordinates[1] = c2.getCoordinate();
	LineString line = geometryFactory.createLineString(coordinates);
	Point c = line.getCentroid();
	double x = c.getCoordinate().x;
	double y = c.getCoordinate().y;
	/*
	 * double x = (c1.getCoordinate().x - c2.getCoordinate().x) +
	 * c1.getCoordinate().x; while (x > 180.0) { x -= 360.0; } while (x <
	 * -180.0) { x += 360.0; }
	 *
	 * double y = (c1.getCoordinate().y - c2.getCoordinate().y) +
	 * c1.getCoordinate().y; while (y > 90.0) { y -= 180.0; } while (x < -90.0)
	 * { y += 180.0; }
	 */
	String code = "AUTO:42001," + y + "," + x;
	// System.out.println(code);
	CoordinateReferenceSystem auto = CRS.decode(code);
	// System.out.println(auto);
	MathTransform transform = CRS.findMathTransform(DefaultGeographicCRS.WGS84,
			auto);
	Geometry g3 = JTS.transform(g1, transform);
	Geometry g4 = JTS.transform(g2, transform);
	return g3.distance(g4);
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:33,代码来源:AutoProjection.java

示例15: crsTransform

import org.opengis.geometry.MismatchedDimensionException; //导入依赖的package包/类
public static SimpleFeature crsTransform(
		final SimpleFeature entry,
		final SimpleFeatureType reprojectedType,
		final MathTransform transform ) {
	SimpleFeature crsEntry = entry;

	if (transform != null) {
		// we can use the transform we have already calculated for this
		// feature
		try {

			// this will clone the feature and retype it to Index CRS
			crsEntry = SimpleFeatureBuilder.retype(
					entry,
					reprojectedType);

			// this will transform the geometry
			crsEntry.setDefaultGeometry(JTS.transform(
					(Geometry) entry.getDefaultGeometry(),
					transform));
		}
		catch (MismatchedDimensionException | TransformException e) {
			LOGGER
					.warn(
							"Unable to perform transform to specified CRS of the index, the feature geometry will remain in its original CRS",
							e);
		}
	}

	return crsEntry;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:32,代码来源:FeatureDataUtils.java


注:本文中的org.opengis.geometry.MismatchedDimensionException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。