Obtaining polylines within a polygon - google-maps

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.

Related

How to get the key and values of a json string based on a string in the key

I have a JSON file that look like the following:
{
"rooms":{
"operatorLimbo":[
],
"pager":[
"w0vu9ourxkdpkf0vwosrim",
"mekkgn9e9kdpwf2rzpkf41",
"upkicevngkd5s2h8o01wyz",
"x29ywtag4kfs0mylq2rd4v"
],
"ru_pagers":[
"mekkgn9e9kdpwf2rzpkf41"
],
"ch_pagers":[
"upkicevngkd5s2h8o01wyz"
],
"operators":[
"r9agylhvekcoibhrk8db8c",
"p94jb2ocyk5hv0ch8tivk5",
"v7cxhqxa3kdgik1h4t1sx0",
"spuvkm9nnketwnqeelqzbf"
],
"pl_operators":[
"spuvkm9nnketwnqeelqzbf"
],
"clients":[
"g99g943hlkh0kp1864rwpz",
"prky4witjkh0naaswiewzs"
],
"pl_users":[
],
"ru_operators":[
"r9agylhvekcoibhrk8db8c"
],
"ch_operators":[
"v7cxhqxa3kdgik1h4t1sx0"
],
"nl_operators":[
"p94jb2ocyk5hv0ch8tivk5"
],
"nl_pagers":[
"w0vu9ourxkdpkf0vwosrim"
],
"ch_users":[
"prky4witjkh0naaswiewzs"
],
"nl_users":[
"g99g943hlkh0kp1864rwpz"
],
"pl_pagers":[
"x29ywtag4kfs0mylq2rd4v"
],
"ru_users":[
],
"us_operators":[
],
"au_operators":[
],
"au_users":[
],
"au_pagers":[
],
"za_operators":[
],
"yoiqfvvvokh0kp2v53sic9":{
"roomid":"yoiqfvvvokh0kp2v53sic9",
"type":"1to1",
"ujid":"g99g943hlkh0kp1864rwpz",
"aid":"3173aaacd43941c7bef1a99e0057ba2b",
"operator":{
"fullname":"Operator",
"name":"Operator",
"lastname":"Jura"
},
"members":[
"Ss0G3RCClvOO8I03AAIp",
"jZGZ_yAb-SC3bEpmAAJz"
],
"chatRecord":11151,
"ojid":"p94jb2ocyk5hv0ch8tivk5",
"usid":"jZGZ_yAb-SC3bEpmAAJz"
},
"deomjtr27kh0l52ogg9zxh":{
"roomid":"deomjtr27kh0l52ogg9zxh",
"type":"1to1",
"ujid":"prky4witjkh0naaswiewzs",
"aid":"3173aaacd43941c7bef1a99e0057ba2b",
"operator":{
"fullname":"Operator",
"name":"Operator",
"lastname":"Jura"
},
"members":[
"DPeOVb1P6qCVXO6GAAJi",
"AAkb84mpMxLzFHklAAJ7"
],
"chatRecord":11153,
"ojid":"v7cxhqxa3kdgik1h4t1sx0",
"usid":"AAkb84mpMxLzFHklAAJ7"
}
}
}
What I'm interested in is to get values like ch_operators and pl_operators and so on basically all entries that have _operators in it and also the value of it,
with the following code I can get just the keys, how can I get the values as well,
Object.keys(this.rooms).filter((key) => key.includes("_operators"))
any help would be appreciated.
You can use a combination of Object.entries, .filter and Object.fromEntries to create a new object with selected properties:
Object.fromEntries(
Object.entries(this.rooms).filter(([key]) => key.includes("_operators"))
)
Object.entries returns an array containing both key and value (as "tuple"), and Object.fromEntries builds a new object from such an array.

How to edit the JSON structure

I am having a JSON object like below:
{
"ItemIsExportControlled": [
"true",
"false"
],
"OrderShippingDestination": [
"domestic",
"foreign"
],
"CustomerCreditStatus": [
"approved",
"denied",
"unknown"
],
"OrderShipping": [
"ground",
"air",
"sea"
],
"ItemStockStatus": [
"validInStock",
"invalid",
"validOutOfStock"
],
"OrderDeliveryTimeframe": [
"oneMonth",
"immediate",
"oneWeek"
],
"OrderPricingScheme": [
"scheme2",
"scheme1",
"scheme3"
]
}
I am getting two values from onChange event in variables say item and value, so what I need to do is to compare item with this JSON structure keys, and if it matches, then I want to replace the values of that corresponding key with the new value that I got in value variable.
For e.g. If item is ItemIsExportControlled and value is false. Then I want my resulting JSON structure to be
{
"ItemIsExportControlled": [
"false"
],
"OrderShippingDestination": [
"domestic",
"foreign"
],
"CustomerCreditStatus": [
"approved",
"denied",
"unknown"
],
"OrderShipping": [
"ground",
"air",
"sea"
],
"ItemStockStatus": [
"validInStock",
"invalid",
"validOutOfStock"
],
"OrderDeliveryTimeframe": [
"oneMonth",
"immediate",
"oneWeek"
],
"OrderPricingScheme": [
"scheme2",
"scheme1",
"scheme3"
]
}
Can anyone please help me on this. Thanks in advance..
Its simple lets say your JSON is :
const YOUR_JSON = {
"ItemIsExportControlled": [
"true",
"false"
],
"OrderDeliveryTimeframe": [
"oneMonth",
"immediate",
"oneWeek"
],
"OrderPricingScheme": [
"scheme2",
"scheme1",
"scheme3"
]
}
And this could be your onChange function where you are getting item and value
onChange (item, value) {
const result = {...YOUR_JSON, [item]: [value]};
}
You will have updated JSON in result

should streets be represented as LineString or Polygon

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

Drawing Polygons on Google Maps using AngularJS and JSON stored coordinates

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.

Algorithm to find paths in a list of scattered points

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.