3

In the below image I have one point(in blue color) and polyline(in black color).

Using the below sql server 2012 comment i got the nearest path(in red color) between polyline(black) and the point(blue).

DECLARE @pnt geometry, @line geometry;
set @pnt=(select (geometry::Point(81.878517616233,25.443095946868,4326)))
set @line=(SELECT geom from Routes a where ((geometry::Point(81.878517616233,25.443095946868,4326)).STDistance((geometry::Point(a.x1, a.y1,4326)))*111.325) < 2.00 order by (geometry::Point(81.878517616233,25.443095946868,4326)).STDistance((geometry::Point(a.x1, a.y1,4326))) OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY)
print '@pnt== '+cast (@pnt as varchar(max))
print '@line== '+cast (@line as varchar(max))
select 0 AS id, '' AS name,@pnt.ShortestLineTo(@line)--.STBuffer(1)
AS geog
union all
select 0 AS id, '' AS name,
@pnt.ShortestLineTo(@line).STIntersection(@line)--.STBuffer(15)
 AS geog


**@pnt and @line will be in below format**

@pnt== POINT (81.878517616233 25.443095946868)
@line== LINESTRING (81.879984 25.443716000000109, 81.879499000000123 25.443758, 81.879224000000136 25.443786, 81.878727 25.443791, 81.878339 25.443813, 81.878115 25.443826000000115, 81.877997 25.443838, 81.87786 25.443848, 81.877609 25.44387300000011, 81.877387 25.443895, 81.877159 25.443925, 81.876638 25.443987000000106, 81.876532 25.444003)

Can anyone guide me to solve the below queries

  1. how to get the latitude and longitude of the intersected red line and black line?
  2. how we can split the black line with a latitude and longitude?
  3. how we can remove the short length polyline from the result?

enter image description here

closed as too broad by PolyGeo Feb 12 '18 at 21:50

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.