I have one polygon layer and another is point layer,I want to find out orientation automatically of line of polygon which is parallel to the street and closest to the point.i am using QGIS 2.0 .is it any plugin to find out this? Without scripting it can be done?

enter image description here

  • In ArcGis yes, not so much in QGIS. There's a few steps involved: convert to line, add orientation attribute to line, find the closest line and then join points to line using nearest feature id. The geoprocessing tools in QGIS are not adequate. If you were to script this then it is possible in QGIS. There are a great many plugins so I guess it would be possible, but not likely. – Michael Stimson Apr 17 '14 at 4:26
  • i dont know about scripting, but as mentioned, in ArcGIS it is without scripting? – s_3db Apr 17 '14 at 9:25
  • Yes, they are geoprocessing tools and ArcMap operations. The bit about putting orientation on the line is tricky but could be done in 'calculate field' using a simple python script - that by itself is worthy of a GIS.SE question. Do you want the instructions on how to do this in ArcGIS? – Michael Stimson Apr 17 '14 at 22:31
  • i become greedy,but yes it would be appriciated.. – s_3db Apr 21 '14 at 8:52

To do this in ArcMap an Advanced level of license is required.

First break down the polygons into lines using "feature to line"

If the lines aren't broken into segments properly use "planarize lines" in the editing toolbar, this will give you short line segments mostly two point lines which should be acceptable depending on how picky you need to be, if you need to you can manually split some using the editor "Split tool".

Save and stop editing. Either add fields using attribute table or "add field" tool, all fields are type double. Add X_From, Y_From, X_To, Y_To and Orient fields, open the attribute table in ArcMap and populate with "Calculate Geometry"; populate the X_From as the X Coordinate of Start, Y_From as Y Coordinate of Start, X_To as X Coordinate of end and finally Y_To as Y Coordinate of end.

While the attribute table is open calculate the field with a python code block using the formula:

(math.atan(( !Y_To! - !Y_From! )/(!X_To!- !X_From!)) * 180)/math.pi

This will give degrees, some will be negative, depending on how you want your angles stated you might need to do some Pythagorean maths here.

Now that the angles are populated on the lines use "Near" to determine which is the closest line to each point. This tool will add a field called NEAR_FID (or something like that) to the point feature class with the FID/OID of the closest feature in the lines. Join the table of points onto lines using NEAR_FID to FID/OID and then calculate the orientation onto the points.

There are quite a few steps involved but it can be done manually; it is this sort of convoluted process that encourages aspiring GIS professionals to learn Python! Please consider doing some of the on-line tutorials in Python for ArcGis, it will make your tasks much easier and less reliant on remembering.

  • Thank you very much for your help,i am trying to get into this,i m not GIS professional,i m into architecture field,this is my projectbasis need.i m hoping to get this,thank you once again – s_3db Apr 22 '14 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.