From the road centreline, I'd use a Densifier to 1m or 5m frequency, Chop into individual vertices. Then a NeighborFinder between the road polygons and centreline points, treating polygons as lines. That'll give the distance from each centreline point to the edge. Multiply by 2 to get the width.
Then you need to decide how you want to define road width, whether it's per road segment, per road name, per centreline etc. Use a StatisticsCalculator to get the median width, across whatever group you choose to group by.
After you have split your polygon (for which you have posted a separate question) you can get a quick approximation of the lenght and width from the area and perimeter of the polygon.
Approx_Length = @Evaluate(@Length()/4 + @sqrt(@pow(@Length()/4,2)-@Area()))
Approx_Width = @Evaluate(@Length()/4 - @sqrt(@pow(@Length()/4,2)-@Area()))
This works best for long thin polygons.
From the road centreline, I'd use a Densifier to 1m or 5m frequency, Chop into individual vertices. Then a NeighborFinder between the road polygons and centreline points, treating polygons as lines. That'll give the distance from each centreline point to the edge. Multiply by 2 to get the width.
Then you need to decide how you want to define road width, whether it's per road segment, per road name, per centreline etc. Use a StatisticsCalculator to get the median width, across whatever group you choose to group by.
Thank for your sharing the good idea! I'll try it! 😊
After you have split your polygon (for which you have posted a separate question) you can get a quick approximation of the lenght and width from the area and perimeter of the polygon.
Approx_Length = @Evaluate(@Length()/4 + @sqrt(@pow(@Length()/4,2)-@Area()))
Approx_Width = @Evaluate(@Length()/4 - @sqrt(@pow(@Length()/4,2)-@Area()))
This works best for long thin polygons.
Yes, thank you so much! I want to know how width of road before each parcel (or house). So I need calculate it with small segments and after that I assign the value to each parcel which nearest with the point. That is my idea!Â
HiÂ
I want to calculate min, max, avg width(breadth) from polygons.
My input have only list polygons:
{ "type": "Feature", "properties": { "OBJECTID": 1.0, "SHAPE_Leng": 0.00057672519222000005, "SHAPE_Area": 5.191152e-09, "name": null, "rongMax": null, "rongMin": null, "rongTB": null }, "geometry": { "type": "MultiPolygon", "coordinates": y e :  105.814052974000049, 21.009160664000035 ],  105.814018928000053, 21.00919353200004 ], , 105.814021210000078, 21.009195662000025 ], Â 105.814026385000034, 21.009202952000066 ], 0 105.81405440900005, 21.009242426000071 ], 9 105.814090260000057, 21.009269388000064 ], 2 105.814124937000088, 21.009292263000077 ], . 105.814203617000032, 21.009343118000061 ], Â 105.814214316000061, 21.009350654000059 ], 0 105.814223964000064, 21.009340076000058 ], 6 105.814170518000083, 21.009304149000059 ], 2 105.81414109900004, 21.009282088000077 ], . 105.814117868000039, 21.009266112000034 ],  105.814087328000085, 21.009244852000052 ],  105.814074111000082, 21.009232288000078 ],  105.814072411000041, 21.009232829000041 ], 0 105.814058327000055, 21.009186317000058 ], 8 105.814055345000043, 21.009175664000054 ], 3 105.814052974000049, 21.009160664000035 ] ] ] ] } }
Can you give me some iead to solve it, or tool, or code example.
Many thanks
Here I had drawn it to easy understand:
​
There is a great custom transformer called BoundsSplitter on FME Hub. It can create cross lines at a set interval. Next you can calculate the length of these lines, and determine the minimal, maximal and mean length.
There is a great custom transformer called BoundsSplitter on FME Hub. It can create cross lines at a set interval. Next you can calculate the length of these lines, and determine the minimal, maximal and mean length.
The BoundsSplitter custom transformer does contain Python code, which does most of the work. You can look into it if you want.
I did not create this transformer, and I am no Python specialist, so unfortunately I cannot help you there.
Hi, you can find the Python code inside the custom transformer BoundsSplitter.
Just add the transformer to your FME workspace (or open the workspace I provided yesterday), right-click the transformer, and click Edit. The Python code is inside the PythonCaller inside the BoundsSplitter. It is best to study the Python code inside the FME environment, because of the dependencies. Good luck!
Hi, you can find the Python code inside the custom transformer BoundsSplitter.
Just add the transformer to your FME workspace (or open the workspace I provided yesterday), right-click the transformer, and click Edit. The Python code is inside the PythonCaller inside the BoundsSplitter. It is best to study the Python code inside the FME environment, because of the dependencies. Good luck!
sorry @geomancer​ I am a new bie, so I can not find where transformer to edit
I'm happy that You can tutorial or copy python to here.
Thank you
HiÂ
I want to calculate min, max, avg width(breadth) from polygons.
My input have only list polygons:
{ "type": "Feature", "properties": { "OBJECTID": 1.0, "SHAPE_Leng": 0.00057672519222000005, "SHAPE_Area": 5.191152e-09, "name": null, "rongMax": null, "rongMin": null, "rongTB": null }, "geometry": { "type": "MultiPolygon", "coordinates": y e :  105.814052974000049, 21.009160664000035 ],  105.814018928000053, 21.00919353200004 ], , 105.814021210000078, 21.009195662000025 ], Â 105.814026385000034, 21.009202952000066 ], 0 105.81405440900005, 21.009242426000071 ], 9 105.814090260000057, 21.009269388000064 ], 2 105.814124937000088, 21.009292263000077 ], . 105.814203617000032, 21.009343118000061 ], Â 105.814214316000061, 21.009350654000059 ], 0 105.814223964000064, 21.009340076000058 ], 6 105.814170518000083, 21.009304149000059 ], 2 105.81414109900004, 21.009282088000077 ], . 105.814117868000039, 21.009266112000034 ],  105.814087328000085, 21.009244852000052 ],  105.814074111000082, 21.009232288000078 ],  105.814072411000041, 21.009232829000041 ], 0 105.814058327000055, 21.009186317000058 ], 8 105.814055345000043, 21.009175664000054 ], 3 105.814052974000049, 21.009160664000035 ] ] ] ] } }
Can you give me some iead to solve it, or tool, or code example.
Many thanks
Here I had drawn it to easy understand:
​
Hi, can you show me your email or phone? I will contact and guide you to solve this issue! Thank
From the road centreline, I'd use a Densifier to 1m or 5m frequency, Chop into individual vertices. Then a NeighborFinder between the road polygons and centreline points, treating polygons as lines. That'll give the distance from each centreline point to the edge. Multiply by 2 to get the width.
Then you need to decide how you want to define road width, whether it's per road segment, per road name, per centreline etc. Use a StatisticsCalculator to get the median width, across whatever group you choose to group by.
Or you can contact me by phone: 0944550477 or email: pqtkha@gmail.com
Hi, you can find the Python code inside the custom transformer BoundsSplitter.
Just add the transformer to your FME workspace (or open the workspace I provided yesterday), right-click the transformer, and click Edit. The Python code is inside the PythonCaller inside the BoundsSplitter. It is best to study the Python code inside the FME environment, because of the dependencies. Good luck!
Hi @tuphamkhactu122​ , (1) right-click the BoundsSplitter transformer, and (2) select Edit in the popup-menu that appears. This opens a new tab (3) called BoundsSplitter in FME Workbench. On this new tab (4) open the PythonCaller.
Hi @geomancer​Â
after trying to improve. I saw that: with the polygon in same direction, the calculate good, but with complicated polygon(multi direction), work badly.
Now I think, if can determine the direction and split polygons to blocks. It works better.
Have you have ideas to solve it??(split polygon to block with same direction)
Many thanks.
Here is my data:
{ "type": "Feature", "properties": { "OBJECTID": 6.0, "SHAPE_Leng": 0.0018435614763720001, "SHAPE_Area": 1.830693e-08, "name": null, "rongMax": null, "rongMin": null, "rongTB": null }, "geometry": { "type": "MultiPolygon", "coordinates": ,  r n 105.814233473000058, 21.009605263000026 ], u 105.814270254000064, 21.009557108000024 ], 5 105.814294123000082, 21.009508220000043 ], Â 105.814310222000074, 21.00947741400006 ], ] 105.814272326000037, 21.009456668000041 ], 4 105.814212241000064, 21.009415109000031 ], 0 105.81420315400004, 21.00940840100003 ], 5 105.81417328200007, 21.009386347000031 ], . 105.814165209000066, 21.009398109000074 ],  105.814144615000032, 21.009394712000073 ], , 105.814124802000038, 21.009382587000061 ], 0 105.814117689000057, 21.009392403000049 ], 1 105.814070315000038, 21.009362398000064 ], 1 105.814035767000064, 21.00933989300006 ], 5 105.81399544900006, 21.009314226000072 ], [ 105.813992317000043, 21.00931666200006 ],  105.813938111000084, 21.009278877000042 ], 0 105.813956262000033, 21.009253924000063 ], 0 105.813898282000082, 21.009273615000041 ], 6 105.813906806000034, 21.009281664000071 ], 2 105.813926242000036, 21.009296736000067 ], . 105.813930008000057, 21.009292257000027 ], Â 105.814022481000052, 21.009355528000071 ], 0 105.814091046000044, 21.009398283000053 ], 2 105.814108600000054, 21.009407042000078 ], 3 105.814147095000067, 21.009413957000049 ], 8 105.814147350000042, 21.009413089000077 ], 1 105.814174914000034, 21.009421213000053 ],  105.814174412000057, 21.009422525000048 ],  105.814199988000041, 21.009438416000023 ], 0 105.814196086000038, 21.00944436900005 ], 8 105.81427995100006, 21.009495137000044 ], 9 105.81422490500006, 21.009573164000074 ], 2 105.814231047000078, 21.009576607000042 ], 1 105.814197398000033, 21.009632903000067 ], 0 105.814200504000041, 21.009634568000024 ], 5 105.814165204000062, 21.009698650000075 ], 2 105.814130529000067, 21.009681203000071 ], 1 105.814110726000081, 21.009670929000038 ], 0 105.814077452000049, 21.00965476600004 ],  105.814043983000033, 21.009639770000035 ],  105.814037492000068, 21.009636667000052 ], 0 105.814028830000041, 21.009653373000049 ], 3 105.814056730000061, 21.009666333000041 ], 7 105.814085146000082, 21.009679532000064 ], 0 105.814120301000059, 21.009698368000045 ], 2 105.814155253000081, 21.009715444000051 ], 8 105.81417351500005, 21.009716377000075 ], 0 105.814180653000051, 21.009702379000032 ], 6 105.814231116000087, 21.009606946000076 ], 1 105.814233473000058, 21.009605263000026 ] ] ] ] } }
Â
Hi @tuphamkhactu122​, that is a good question. Thanks for the sample polygon!
To split this polygon, I looked (with the PolylineAnalyzer, another great custom transformer from the Hub) for the vertices where the change in direction is about 270 degrees, and then only the vertices that have no other vertex of this kind nearby. From these vertices I created splitting lines, with which I then split the polygon.
This method will not work for polygons with slightly concave vertices, so probably there are better solutions.