Skip to content
Advertisement

How to create a rectangle for azimuth direction for n kilimeter

Suppose I have three four columns like item,item_latitude,item_longitude and azimuth.

I am trying to create a rectangle for each lat and long in the azimuth direction for +/-35 degree and 2 Kilometer.

Example . There is a azimuth of site x is 45 degree so +35 and -35 degree to 45 degree would be 15 degree and 80 degree and distance would be 2 KM

i am trying to get all polygon for that area.I have used jts.util.GeometricShapeFactory Library but it always create a circle like below .I have used scala with jts.util.GeometricShapeFactory Library.

JavaScript

The above code create the circle around the lat and long, but i need to create the rectangle in the direction of azimuth only +/- 35 degree.

Please help me i am new in Geometry. The code may be in any programming like JAVA/SCALA/PHP/PYTHON/MYSQL/POSTGRES/MONGODB or even mathematics pseudo code

Advertisement

Answer

You need to create a function that compute a point from another point in an certain azimuth and at a certain distance (see geographic distance and azimuth chapter 1C]Then call the function :

  • loop from item point to azimuth – delta on azimuth at distance
  • loop from azimuth – delta azimuth to azimuth + delta azimuth at distance
  • loop from azimuth + delta at distance to item point :

Code :

JavaScript

pList = [[p0Lat,p0Lon]]

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement