DavidWood2001-zz / SOFT152-Assignment

This is a repo that contains all of the files for the SOFT152 assignment, also known as the AirBnB Assignment.
0 stars 0 forks source link

Change how the x and y coords are calculated #25

Closed DavidWood2001-zz closed 4 years ago

DavidWood2001-zz commented 4 years ago

x coord in relation to the center of the map is the wrong way to do it. Instead go from the top left hand corner. 1) Find the lat and long of the top left corner 2) convert that into x,y 3) find the lat and long of bottom left and top right corners 4) convert that into x,y 5) using these values you can calculate the x:long and y:lat ratio 6) now property lat/y ratio and property long/y ratio will give the relative x and y value

DavidWood2001-zz commented 4 years ago

This is an semi-correct way to go about this. What is actually needed is to find 1 xUnit in terms of a longitude change (long:x ratio) and 1 yUnit in terms of a latitudinal change (lat:y ratio). Then do (property longitude-origin longitude)/xUnit and (property latitude-origin latitude)/yUnit.

Take property longitude to be 42.122223, origin longitude to be 41.120000 and the x unit to be 0.000012. This would mean that 42.122223 - 41.120000 = 0.002223 and 0.002223/0.000012 = 185.25 so the properties x value would be 185.

This solves the issue of all the ellipses being drawn on top of one another

DavidWood2001-zz commented 4 years ago

This issue has been resolved and is now working correctly please see the commit referring to this issue and the changes that were made to resolve this bug.