What I'm trying to do is to find places which are inside or with 10 meters distance of a street.
My streets table has a geometry column which coordinates are saved from.
A sample coordinate looks like
{ "type": "Feature", "properties": { "id": 4.000000, "osm_id": 69551269.000000, "type": "tertiary", "name": "Street name", "tunnel": 0, "bridge": 0, "oneway": 1, "ref": null, "z_order": 4.000000, "access": null, "service": null, "class": "highway" },
"geometry": { "type": "LineString",
"coordinates": [ [ 45.055701068545773, 37.537045660463036 ], [ 45.055566036085651, 37.536995369044007 ], [ 45.054243455583901, 37.536797891405229 ], [ 45.053941120336447, 37.536756233346466 ], [ 45.053692177812167, 37.536712228354787 ], [ 45.052483758831642, 37.536435290273943 ], [ 45.052157870436275, 37.536344765719662 ], [ 45.051875819394468, 37.536229430731993 ], [ 45.05173206975504, 37.536151395213466 ], [ 45.051607347035826, 37.536067827638817 ], [ 45.051492766419436, 37.535979063284202 ], [ 45.050636052096081, 37.535314881276747 ], [ 45.050383253896371, 37.535111536305749 ], [ 45.050164989137727, 37.534882458892014 ], [ 45.050017048546714, 37.534692692604175 ], [ 45.049976061040212, 37.534639970433204 ], [ 45.049796436855189, 37.534394380670221 ], [ 45.049439032503869, 37.533859196152598 ], [ 45.049149186292141, 37.533424929749174 ], [ 45.048739143588875, 37.532811039160741 ], [ 45.048373357334377, 37.532213577102539 ], [ 45.048231284075598, 37.531903279047071 ], [ 45.048143022635173, 37.531710579093094 ], [ 45.047949568309946, 37.531336494754463 ], [ 45.047873628267183, 37.531189895267971 ], [ 45.047984772303266, 37.53111303321586 ] ] } },
My question is that should the coordinates be saved as polygon or LineString.
GeoJson authoritive indicates that LineString has no inside or outside but the data which I've got from openstreet(above is a sample) has a type of LineString.
So Which one should I use?
Edit:
A sample LineString from openstreetmap looks like this:
I drew them by drawing a polygon with coordinates.
Either of the two of geometry types, linestrings and polygon would work for you in your case. But i think it is quite straightforward to convert the linestrings to polygon and just use ST_Buffer the polygon with 20m...
SET #line = ST_GeomFromText('LINESTRING(44.9894318 37.496227, 44.9901579 37.4964403)',4326); SET #pt = ST_GeomFromText('POINT(45.00 37.4964)',4326); SET #buffer=st_buffer(#line,0.0124274); SELECT ST_WITHIN(#pt,#buffer)
20 meters = 0.0124274 mile,
Difference between Geography coordinate system and geometry coordinate system: https://en.wikipedia.org/wiki/Geographic_coordinate_system
Related
As I understand it, a road in google maps is just a polyline defined by two coordinates. I have what I think is called a GeoJSON object which contains a polygon denoted by coordinates. Something like this:
{ "type": "Polygon", "coordinates": [ [ [ -99.18203782777724, 19.41138655848177 ], [ -99.18207821061841, 19.411385235435223 ], [ -99.18211859345887, 19.41138391237971 ], [ -99.18217229954912, 19.41129771640372 ], [ -99.18281836026513, 19.410260378156483 ], [ -99.18334680960682, 19.40941189646689 ], [ -99.18341718268485, 19.40929908872516 ], [ -99.18377407635555, 19.408725974544847 ], [ -99.1842766660324, 19.407918887878647 ], [ -99.18414908809605, 19.407875016070705 ], [ -99.18250913471286, 19.407311054834768 ], [ -99.18120954747532, 19.406864128294814 ], [ -99.18070215205267, 19.406687781845125 ], [ -99.180621459197, 19.40670890218962 ], [ -99.18054076632019, 19.4067300224984 ], [ -99.18028848137924, 19.406796054527465 ], [ -99.17966378043319, 19.406825151645055 ], [ -99.17878740320279, 19.40703143744027 ], [ -99.1785393781354, 19.407139891327162 ], [ -99.17797365982572, 19.40747166796296 ], [ -99.17760898455877, 19.407685537303376 ], [ -99.17743789039321, 19.407562529856033 ], [ -99.17732736375932, 19.407678429335242 ], [ -99.17658848127857, 19.408486655455793 ], [ -99.17641778851832, 19.40867504231124 ], [ -99.17582025539072, 19.40933502954438 ], [ -99.17523169830358, 19.409962438803724 ], [ -99.17515421523987, 19.41005409433415 ], [ -99.17425254437649, 19.411062171115905 ], [ -99.17390065213473, 19.411457392395153 ], [ -99.17408215417474, 19.411468709017452 ], [ -99.17416229240264, 19.41146637588914 ], [ -99.17477464735218, 19.411448546741003 ], [ -99.17497891878078, 19.411414146462644 ], [ -99.17531443486303, 19.41139697628401 ], [ -99.17586186932239, 19.411433226776477 ], [ -99.17688064119534, 19.41143193058924 ], [ -99.17749773097404, 19.411402766318993 ], [ -99.1778173959715, 19.411393938757634 ], [ -99.1779231561884, 19.41139186760553 ], [ -99.17803401741658, 19.411362589376616 ], [ -99.17865599294018, 19.41134248436829 ], [ -99.17888756239012, 19.411340946816228 ], [ -99.17936546074904, 19.41140760398169 ], [ -99.17980066016678, 19.41141478333999 ], [ -99.18033419212767, 19.411419942423137 ], [ -99.1807962910527, 19.411424409505287 ], [ -99.1811402792245, 19.41142773405475 ], [ -99.18088507524732, 19.41076332382733 ], [ -99.18110546532225, 19.410946767251502 ], [ -99.1811374076985, 19.410973354684423 ], [ -99.1819024071804, 19.411322184629903 ], [ -99.18203782777724, 19.41138655848177 ] ] ] }
How could I get the polylines representing the streets within that polygon?
Similar to your other question you can use Overpass API for downloading streets from OpenStreetMap located inside a boundary defined via a polygon.
Example based on our polygon:
[out:xml][timeout:30];
way[highway](poly:"19.41138655848177 -99.18203782777724 19.411385235435223 -99.18207821061841 19.41138391237971 -99.18211859345887 19.41129771640372 -99.18217229954912 19.410260378156483 -99.18281836026513 19.40941189646689 -99.18334680960682 19.40929908872516 -99.18341718268485 19.408725974544847 -99.18377407635555 19.407918887878647 -99.1842766660324 19.407875016070705 -99.18414908809605 19.407311054834768 -99.18250913471286 19.406864128294814 -99.18120954747532 19.406687781845125 -99.18070215205267 19.40670890218962 -99.180621459197 19.4067300224984 -99.18054076632019 19.406796054527465 -99.18028848137924 19.406825151645055 -99.17966378043319 19.40703143744027 -99.17878740320279 19.407139891327162 -99.1785393781354 19.40747166796296 -99.17797365982572 19.407685537303376 -99.17760898455877 19.407562529856033 -99.17743789039321 19.407678429335242 -99.17732736375932 19.408486655455793 -99.17658848127857 19.40867504231124 -99.17641778851832 19.40933502954438 -99.17582025539072 19.409962438803724 -99.17523169830358 19.41005409433415 -99.17515421523987 19.411062171115905 -99.17425254437649 19.411457392395153 -99.17390065213473 19.411468709017452 -99.17408215417474 19.41146637588914 -99.17416229240264 19.411448546741003 -99.17477464735218 19.411414146462644 -99.17497891878078 19.41139697628401 -99.17531443486303 19.411433226776477 -99.17586186932239 19.41143193058924 -99.17688064119534 19.411402766318993 -99.17749773097404 19.411393938757634 -99.1778173959715 19.41139186760553 -99.1779231561884 19.411362589376616 -99.17803401741658 19.41134248436829 -99.17865599294018 19.411340946816228 -99.17888756239012 19.41140760398169 -99.17936546074904 19.41141478333999 -99.17980066016678 19.411419942423137 -99.18033419212767 19.411424409505287 -99.1807962910527 19.41142773405475 -99.1811402792245 19.41076332382733 -99.18088507524732 19.410946767251502 -99.18110546532225 19.410973354684423 -99.1811374076985 19.411322184629903 -99.1819024071804 19.41138655848177 -99.18203782777724");
(._;>;);
out;
You can view the result on overpass turbo after clicking the run button.
I have a table with two columns,One column should store int and other should store json.
here the data which i want to store in the table.
id,polygon
1,"{""type"": ""Feature"",
""properties"": {
""stroke"": ""#555555"",
""stroke-width"": 2,
""stroke-opacity"": 1,
""fill"": ""#00aa22"",
""fill-opacity"": 0.5
},
""geometry"": {
""type"": ""Polygon"",
""coordinates"": [
[
[-76.97021484375,
40.17887331434696
],
[-74.02587890625,
39.842286020743394
],
[-73.4326171875,
41.713930073371294
],
[-76.79443359375,
41.94314874732696
],
[-76.97021484375,
40.17887331434696
]
]
]
}
}"
I tired storing in postgres as follows:
insert into gjl_polygon values(1,'"{""type"":
""Feature"",""properties"": {""stroke"": ""#555555"",""stroke-
width"": 2,""stroke-opacity"": 1,""fill"": ""#00aa22"",""fill-
opacity"": 0.5},""geometry"": {""type"":
""Polygon"",""coordinates"":
[[[-76.97021484375,40.17887331434696],[-74.02587890625,
39.842286020743394 ],[-73.4326171875, 41.713930073371294],
[-76.79443359375,41.94314874732696],
[-76.97021484375,40.17887331434696]]]}}"');
I got the following error,
Expecting ':' delimiter: line 1 column 4 (char 3)
The problem of your code is the use of double quotes twice. Try to edit like this:
{
"type": "Feature",
"properties": {
"stroke": "#555555",
"stroke-width": 2,
"stroke-opacity": 1,
"fill": "#00aa22",
"fill-opacity": 0.5
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-76.97021484375,
40.17887331434696
],
[-74.02587890625,
39.842286020743394
],
[-73.4326171875,
41.713930073371294
],
[-76.79443359375,
41.94314874732696
],
[-76.97021484375,
40.17887331434696
]
]
]
}
}
The JSON above is a valid JSON string and it should work as expected.
I'm using rCharts Leaflet maps to display polygons on map on R.
Using the Leaflet's geoJson I created some polygons and added them to the map. However, those polygons are filled with a default blue color. I'm trying to give them a different color, but no success.
For an example, I used the folloeing JSON, tested it in geojson.io and it came up green, however the R package still plots it in blue, how can I enforce the color?
JSON:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"stroke": "#555555",
"stroke-width": 2,
"stroke-opacity": 1,
"fill": "#00f900",
"fill-opacity": 0.5
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-74.06982421875,
40.64730356252251
],
[
-74.06982421875,
40.79717741518769
],
[
-73.80615234375,
40.79717741518769
],
[
-73.80615234375,
40.64730356252251
],
[
-74.06982421875,
40.64730356252251
]
]
]
}
}
]
}
R:
jsonx <- (JSON above)
polys = RJSONIO::fromJSON(jsonX)
map.center <- c(38,-95)
myMap<-Leaflet$new()
myMap$setView(map.center, 4)
myMap$tileLayer(provider = "Esri.WorldGrayCanvas")
myMap$geoJson(polys)
myMap$set(dom = 'myChart2')
myMap
While the rCharts implementation was nice, RStudio's leaflet package based on htmlwidgets is much more full-featured and robust. If you can use it instead, here is an answer. Note, nothing needs to be done. leaflet will pick up the fill in your geoJSON.
# uncomment to install the most recent from github
# devtools::install_github("rstudio/leaflet")
# or older cran #install.packages("leaflet")
library(leaflet)
gj <- '
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"stroke": "#555555",
"stroke-width": 2,
"stroke-opacity": 1,
"fill": "#00f900",
"fill-opacity": 0.5
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-74.06982421875,
40.64730356252251
],
[
-74.06982421875,
40.79717741518769
],
[
-73.80615234375,
40.79717741518769
],
[
-73.80615234375,
40.64730356252251
],
[
-74.06982421875,
40.64730356252251
]
]
]
}
}
]
}
'
leaflet() %>%
addTiles() %>%
setView( -74.1, 40.7, zoom = 10) %>%
addGeoJSON( gj )
# to show fill works let's change it with gsub
leaflet() %>%
addTiles() %>%
setView( -74.1, 40.7, zoom = 10) %>%
addGeoJSON(
gsub(
x = gj
,pattern = '(\\"fill\": \\"#00f900\\",)'
,replacement = ""
)
# demo addGeoJSON fillColor argument
,fillColor = 'green'
)
I have multiple JSON files (poly1.json, poly2.json) with the following setup:
{
"Polygon1": {
"name": "poly1",
"specifications": [
{
"areaGeometry": {
"type": "Polygon",
"coordinates": [
[
[
5.129820025,
52.085407733
],
[
5.129117875,
52.086181679
],
[
5.128497179,
52.087946286
],
[
5.128458022,
52.088253322
],
[
5.12866837,
52.088507157
],
[
5.129251266,
52.088976802
],
[
5.129473861,
52.08926905
],
[
5.129385309,
52.089499203
],
[
5.12909759,
52.089698198
],
[
5.127961124,
52.090148712
],
[
5.127685173,
52.090462912
],
[
5.127310682,
52.091653473
],
[
5.12710699,
52.092271708
],
[
5.127126612,
52.092518366
],
[
5.128237531,
52.093468305
],
[
5.128130926,
52.093688728
],
[
5.126525853,
52.094399058
],
[
5.126377274,
52.09459342
],
[
5.126284571,
52.095035437
],
[
5.130996578,
52.095312264
],
[
5.137138625,
52.095591962
],
[
5.139036247,
52.095628598
],
[
5.138962372,
52.095484813
],
[
5.137879856,
52.093651573
],
[
5.137480747,
52.093048367
],
[
5.136997815,
52.092468872
],
[
5.13643473,
52.091917507
],
[
5.135795776,
52.091398471
],
[
5.134288171,
52.090401311
],
[
5.133608279,
52.089984575
],
[
5.133259679,
52.089768435
],
[
5.132932239,
52.089549796
],
[
5.132656508,
52.089342179
],
[
5.132411195,
52.089120552
],
[
5.132198186,
52.088886599
],
[
5.132143714,
52.088818019
],
[
5.130950838,
52.087097103
],
[
5.130737143,
52.086736442
],
[
5.130575274,
52.086365674
],
[
5.130403794,
52.085570404
],
[
5.129783706,
52.08522338
],
[
5.129820025,
52.085407733
]
]
]
}
}
],
}
}
Now I want to draw all the polygons on Google Maps on where the user is looking at -if there is a polygon in his screen. What is the best way to do so? Should I use for each or are there better ways? How do you iterate over it? Would that not make it slow?
According to my understanding, there are two ways you can go about it. First, you can make a KML layer. You can put together all these polygons in one KML file and make an overlay and integrate that overlay with your map object. (Here's the JQuery reference)
Another way to do it is by using your JSON files and making a data layer. I would suggest to use the drag and drop GeoJSON code example as a reference. Because that will give you accuracy to the specific points. But you can always go for the simpler implementation, you can find other sample codes from Google on the left side of this link.
I have a list of points taken from measuring a model. An important part of the analyses to be made consist on finding "candidate paths" along these points, that will further be trimmed and refined.
Below there are images showing a plot of the raw data, and a hand-made drawing of what the detected paths would look like. These paths should be continuous and approximately vertical, and the output format would be a list of lists of points (color of points is not relevand for path-finding itself):
I suppose this can be solved by brute-force, exhaustive methods, but I suppose, either, there can be some well-known algorithm for this.
I use Python, so Numpy/Scipy examples would be greatly appreciated (scipy.spatial sounds like the perfect candidate for that)
EDIT: a sample dataset is provided below (list of [x,y,weight] points):
[[ -0.7898176 -3.35201728 4.36142086]
[ 2.99221402 -3.35201728 1.11907575]
[ 6.97475149 -3.35201728 2.4320322 ]
[ -4.82443609 -2.35201728 0.6479064 ]
[ -1.32418909 -2.35201728 1.88004944]
[ 0.07067882 -2.35201728 1.10982834]
[ 3.09169448 -2.35201728 1.8557436 ]
[ 7.10399403 -2.35201728 2.03906224]
[ -3.07207606 -1.35201728 0.35500973]
[ 2.63202993 -1.35201728 5.32397834]
[ 5.19884868 -1.35201728 1.63816326]
[ 7.65721835 -1.35201728 1.13843392]
[ 2.48172754 -0.35201728 6.65584512]
[ 6.0905911 -0.35201728 1.15552652]
[ 8.62497546 -0.35201728 0.30407144]
[ -4.7300089 0.64798272 0.31481496]
[ -3.03274093 0.64798272 0.95337568]
[ 2.19653614 0.64798272 10.3675204 ]
[ 6.20384058 0.64798272 1.42106077]
[ -4.08636605 1.64798272 0.28875288]
[ 2.03344989 1.64798272 13.04648211]
[ -4.11717795 2.64798272 0.39713141]
[ 1.93304283 2.64798272 10.41313242]
[ -4.37994815 3.64798272 0.84588643]
[ 1.66081408 3.64798272 14.96380955]
[ -4.19024027 4.64798272 0.73216113]
[ 1.60252433 4.64798272 14.72419286]
[ 6.77837359 4.64798272 0.6186005 ]
[ -4.14362668 5.64798272 0.93673165]
[ 1.55372968 5.64798272 12.9421123 ]
[ -4.62223541 6.64798272 0.6510101 ]
[ 1.527865 6.64798272 10.80209351]
[ 6.86820685 6.64798272 0.82550801]
[ -4.68259732 7.64798272 0.45321369]
[ 1.36167494 7.64798272 6.45338514]
[ -5.19205787 8.64798272 0.23935013]
[ 1.21003466 8.64798272 10.13528877]
[ 7.6689546 8.64798272 0.32421776]
[ -5.36436818 9.64798272 0.79809416]
[ 1.26248534 9.64798272 7.67036253]
[ 7.35472418 9.64798272 0.92555691]
[ -5.61723652 10.64798272 0.4741007 ]
[ 1.23101086 10.64798272 7.97064105]
[ -7.83024735 11.64798272 0.47557318]
[ 1.20348982 11.64798272 8.20694816]
[ 1.14422758 12.64798272 9.26244889]
[ 9.18164464 12.64798272 0.72428381]
[ 1.0827069 13.64798272 10.08599118]
[ 6.80116007 13.64798272 0.4571425 ]
[ 9.384236 13.64798272 0.42399893]
[ 1.04053491 14.64798272 10.48370805]
[ 9.16197972 14.64798272 0.39930227]
[ -9.85958581 15.64798272 0.39524976]
[ 0.9942501 15.64798272 8.39992264]
[ 8.07642416 15.64798272 0.61480371]
[ 9.55088151 15.64798272 0.54076473]
[ -7.13657331 16.64798272 0.32929172]
[ 0.92606211 16.64798272 7.83597033]
[ 8.74291069 16.64798272 0.74246827]
[ -7.20022443 17.64798272 0.52555351]
[ 0.81344517 17.64798272 6.81654834]
[ 8.52844624 17.64798272 0.70543711]
[ -6.97465178 18.64798272 1.04527813]
[ 0.61959631 18.64798272 10.33529022]
[ 5.733054 18.64798272 1.2309691 ]
[ 8.14818453 18.64798272 1.37532423]
[ -6.82823664 19.64798272 2.0314052 ]
[ 0.56391636 19.64798272 13.61447357]
[ 5.79971126 19.64798272 0.30148347]
[ 8.01499476 19.64798272 1.72465327]
[ -6.78504689 20.64798272 2.88657804]
[ -4.79580634 20.64798272 0.36201975]
[ 0.548376 20.64798272 7.8414544 ]
[ 7.62258506 20.64798272 1.52817905]
[-10.50328534 21.64798272 0.90358671]
[ -6.59976138 21.64798272 2.62980169]
[ -3.71180255 21.64798272 1.27094175]
[ 0.5060743 21.64798272 11.06117677]
[ 4.51983105 21.64798272 1.74626435]
[ 7.50948795 21.64798272 3.46497629]
[ 11.10199877 21.64798272 1.78047269]
[-10.15444935 22.64798272 1.47486166]
[ -6.26274479 22.64798272 4.73707852]
[ -3.45440904 22.64798272 1.72516012]
[ 0.52759064 22.64798272 12.58470433]
[ 4.22258017 22.64798272 2.63827535]
[ 7.03480033 22.64798272 3.506412 ]
[ 10.63560314 22.64798272 3.56076386]
[ -5.95693623 23.64798272 2.97403863]
[ -3.66261423 23.64798272 2.31667236]
[ 0.52051366 23.64798272 12.5526344 ]
[ 4.21083787 23.64798272 1.95794387]
[ 6.82438636 23.64798272 4.77995659]
[ 10.18138299 23.64798272 5.21836205]
[ -9.94629932 24.64798272 0.4074823 ]
[ -5.74101948 24.64798272 2.60992238]
[ 0.52987226 24.64798272 10.68846987]
[ 6.29981921 24.64798272 3.56204471]
[ 9.96431168 24.64798272 2.85079129]
[ -9.64229717 25.64798272 0.4503241 ]
[ -5.579063 25.64798272 0.64475469]
[ 0.52053534 25.64798272 10.05046667]
[ 5.79167815 25.64798272 0.92797027]
[ 10.05116919 25.64798272 2.52194933]
[ -8.55286247 26.64798272 0.94447148]
[ 0.45065604 26.64798272 10.97432823]
[ 5.50068393 26.64798272 2.39645232]
[ 10.08992273 26.64798272 2.77716257]
[-16.62381217 27.64798272 0.2021621 ]
[ -9.62146213 27.64798272 0.62245778]
[ -7.66905507 27.64798272 2.84466396]
[ 0.38656111 27.64798272 10.74369366]
[ 5.76925402 27.64798272 1.13362978]
[ 9.83525197 27.64798272 1.18241147]
[-15.64874512 28.64798272 0.18279302]
[ -7.52932494 28.64798272 2.94012191]
[ 0.32171219 28.64798272 10.73770466]
[ 9.4062684 28.64798272 1.41714298]
[-12.71287717 29.64798272 0.70268073]
[ -7.59473877 29.64798272 2.16183026]
[ 0.20748772 29.64798272 12.97312987]
[ 3.92952496 29.64798272 1.54987681]
[ 9.05148017 29.64798272 2.40563748]
[ 14.96021523 29.64798272 0.55258241]
[-12.14428813 30.64798272 0.36365363]
[ -7.12360666 30.64798272 2.54312163]
[ 0.40594038 30.64798272 12.64839117]
[ 4.59465757 30.64798272 1.23496581]
[ 8.54333134 30.64798272 2.18912857]
[-10.6296531 31.64798272 1.4839259 ]
[ -7.09532763 31.64798272 2.0113838 ]
[ 0.37037733 31.64798272 12.2071139 ]
[ 3.01253349 31.64798272 3.01591777]
[ 4.64523695 31.64798272 3.50267541]
[ 8.39369696 31.64798272 2.53195817]
[ -7.07947026 32.64798272 1.01324147]
[ 0.39269437 32.64798272 9.67368625]
[ 8.58669997 32.64798272 1.00475646]
[ 12.02329114 32.64798272 0.50782399]
[-10.13060786 33.64798272 0.31475653]
[ -7.30360407 33.64798272 0.35065243]
[ 0.49556923 33.64798272 9.66608818]
[ -5.37822311 34.64798272 0.38727401]
[ 0.4958055 34.64798272 7.5415026 ]
[ 6.07719006 34.64798272 0.63012453]
[ -4.64579055 35.64798272 0.39990249]
[ 0.46323666 35.64798272 4.60449213]
[ 4.72819312 35.64798272 0.98050594]
[ -4.62418372 36.64798272 0.64160709]
[ 0.48866236 36.64798272 4.29331656]
[ 5.06493722 36.64798272 0.59888608]
[ 0.49730481 37.64798272 1.32828464]
[ -1.31849217 38.64798272 0.70780886]
[ 1.70966455 38.64798272 0.88052135]
[ 0.06305774 39.64798272 0.47366487]
[ 2.13639356 39.64798272 0.67971461]
[ -0.84726354 40.64798272 0.63787522]
[ 0.55723562 40.64798272 0.62855097]
[ 2.22359779 40.64798272 0.33884894]
[ 0.77309816 41.64798272 0.4605534 ]
[ 0.56144565 42.64798272 0.43678788]]
Thanks for any help!
You could find Delaunay triangulation for your points. This gives a graph where points are connected to each other.
Then you could remove all edges of this graph that either are too long or go in wrong direction.
Finally, you could find all vertices of this graph that do not form a proper chain (have more than 2 incident edges or have two incident edges with angle between them too far from 2*pi). And keep only the most appropriate edges.