it is need to calculate the coordinate of the intersection point that is between the road and the designated distance from the starting point

StackOverflow https://stackoverflow.com/questions/6060460

  •  15-11-2019
  •  | 
  •  

문제

Knowning the coordinate of the starting point on a road ,it is need to calculate the coordinate of the intersection point that is between the road and the designated distance from the starting point。This kind of question just like the SDO-LRS.LOCATE_PT function in oracle spatial 。Does have the similiar API on GeoTools or neo4j spatial?

도움이 되었습니까?

해결책

I'm not sure if geotools provides exactly this function. However, there is a related one in JTS, which both Geotools and Neo4j-Spatial use. Look at the JTS package com.vividsolutions.linearref, which has classes for searching along linear geometries for points, or creation/projection of points. I think the method LengthIndexedLine.extractPoint(length) might be what you are looking for.

In Neo4j-Spatial we have a utility which makes use of the LocationIndexedLine (but not yet LengthIndexedLine). See the test code in TestSpatialUtils, and the code it calls in SpatialTopologyUtils.

There are also two Google Summer of Code projects this year that are working on features related to this. One is specifically about Geoprocessing, and we will expose these kinds of functions with a simple API in Neo4j-Spatial. The other is more about data mining of OSM data models, but could also touch on these functions. For more information, watch the neo4j and udig mailing lists. By the end of the summer we will have a much richer set of Geoprocessing functions available in Neo4j-Spatial.

다른 팁

I just pushed some code to Neoj4-Spatial to wrap the JTS method LengthIndexedLine.extractPoint with a new method locatePoint that behaves the same as the Oracle SDO_LRS.LOCATE_PT methods. So, at least on trunk, Neo4j-Spatial now has this capability. In reality the code for this is trivial, since it wraps the JTS code, so the capabilities have always been there, but now look a little more like the Oracle API.

The previously mentioned GSoC projects will try to standardize the API somewhat, so that a more complete set of functions is available in an intuitive way.

  PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING_SINGLE);
  GeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0);
  Coordinate[] coordinates = new Coordinate[3];
  coordinates[0] = new Coordinate(0, 0);
  coordinates[1] = new Coordinate(5, 5);
  coordinates[2] = new Coordinate(10, 0);
  CoordinateSequence coordinateSequence = new CoordinateArraySequence(coordinates);
  Geometry geo = new LineString(coordinateSequence, geometryFactory);   
  LengthLocationMap lengthLocationMap = new LengthLocationMap(geo);
  LocationIndexedLine locationIndexedLine = new LocationIndexedLine(geo);
  LinearLocation linearLocation = lengthLocationMap.getLocation(len);
  Coordinate result = locationIndexedLine.extractPoint(linearLocation);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top