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


Java LocationIndexedLine.project方法代码示例

本文整理汇总了Java中com.vividsolutions.jts.linearref.LocationIndexedLine.project方法的典型用法代码示例。如果您正苦于以下问题:Java LocationIndexedLine.project方法的具体用法?Java LocationIndexedLine.project怎么用?Java LocationIndexedLine.project使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vividsolutions.jts.linearref.LocationIndexedLine的用法示例。


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

示例1: snapPointToLineStringByLIL

import com.vividsolutions.jts.linearref.LocationIndexedLine; //导入方法依赖的package包/类
public static Point snapPointToLineStringByLIL(LineString line, Point point) {
	//new PrecisionModel(
	System.out.println("scale " + pm.getScale());
	LocationIndexedLine lil = new LocationIndexedLine(line);
	LinearLocation here = lil.project(point.getCoordinate());
	Coordinate coord = lil.extractPoint(here, 0);
	Point p = gf.createPoint(coord);
	
	System.out.println("LIL isContains : " + line.contains(p));
	System.out.println("point : " + point.toText());
	System.out.println("extracted poitn : " + p.toText());
	
	return p;
}
 
开发者ID:STEMLab,项目名称:JInedit,代码行数:15,代码来源:JTSUtil.java

示例2: evaluate

import com.vividsolutions.jts.linearref.LocationIndexedLine; //导入方法依赖的package包/类
public <T> T evaluate(Object object, Class<T> context) {
    Expression pointExpression = parameters.get(0);
    Point point = pointExpression.evaluate(object, Point.class);

    Expression lineExpression = parameters.get(1);
    Geometry line = lineExpression.evaluate(object, Geometry.class);

    LocationIndexedLine index = new LocationIndexedLine(line);

    LinearLocation location = index.project(point.getCoordinate());

    Coordinate snap = index.extractPoint(location);

    Point pt = point.getFactory().createPoint(snap);

    return Converters.convert(pt, context); // convert to requested format
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:18,代码来源:SnapFunction.java

示例3: distanceOnLineStringInMeter

import com.vividsolutions.jts.linearref.LocationIndexedLine; //导入方法依赖的package包/类
/**
 * ACHTUNG 
 * 
 * Diese Methode liefert bei Anwendung auf WGS84 Koordinaten falsche Ergebnisse, der Fehler wird 
 * umso größer, je weiter der zu projizierende Punkt von der Linie entfernt ist und je weiter der Punkt vom Aquator entfernt ist.
 *  Wenn der zu projizierende Punkt auf der Linie liegt sollte der Fehler 0 sein.
 *  
 *  Für Salzburg (ca 13E 48N) beträgt der Fehler auf einer 45° schrägen Linie 38.6% des Abstandes von der Linie. D.h. beträgt 
 *  der Abstand des Punktes von der Linie 5m beträgt der Fehler 1,93m.
 *  
 * @param p
 * @param lineString
 * @return
 */
public static double distanceOnLineStringInMeter(Point p, LineString lineString) {
	
	if (p.getSRID() != lineString.getSRID()) {
		throw new IllegalArgumentException("SRID of parameter p is not the same as from parameter lineString");
	}
	LocationIndexedLine indexedStartSeg = new LocationIndexedLine(lineString);
	LinearLocation startLoc = indexedStartSeg.project(p.getCoordinate());
	Geometry cutStartGeom = indexedStartSeg.extractLine(indexedStartSeg.getStartIndex(), startLoc);
	cutStartGeom.setSRID(lineString.getSRID());
	double lengthInMeter = calculateLengthMeterFromWGS84LineStringAndoyer((LineString) cutStartGeom);
	return lengthInMeter;
}
 
开发者ID:graphium-project,项目名称:graphium,代码行数:27,代码来源:GeometryUtils.java

示例4: projectPointOnLineString

import com.vividsolutions.jts.linearref.LocationIndexedLine; //导入方法依赖的package包/类
/**
 * ACHTUNG 
 * 
 * Diese Methode liefert bei Anwendung auf WGS84 Koordinaten eventuell falsche Ergebnisse. 
 * Siehe distanceOnLineStringInMeter()
 * @param p
 * @param lineString
 * @return
 */
public static Point projectPointOnLineString(Point p, LineString lineString) {
	LocationIndexedLine line = new LocationIndexedLine(lineString);
	LinearLocation here = line.project(p.getCoordinate());
	Coordinate coord = line.extractPoint( here );
	Point point = createPoint(coord, lineString.getSRID());		
	return point;
}
 
开发者ID:graphium-project,项目名称:graphium,代码行数:17,代码来源:GeometryUtils.java


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