Get a square region of earth - google-maps

I have a certain region given by the coordinates of the lefttop corner and bottom right corner. However, the region formed is not square since the radius of the circle decreases as the latitude increases. In my case, there is a difference of 3-4 km when I calculate the distance using top two coordinates and the bottom two coordinates So, how can I get a square region. I can't suppose that the the region bounded by the lefttop corner coordinate and bottomright coordinate is square. I want a region where the top two corners have a distance of x miles and the bottom two corners have a distance of x miles. Suggestions?

If you aren't into super-accuracy (ie the words WGS84 and oblate spheroid mean nothing to you) then it's simply a matter of calculating the km/degree of longitude at the upper latitude and then shifting the longitude of the two corners out a little, one east and one west.
Roughly:
Latitude: 1 deg = 110.54 km
Longitude: 1 deg = 111.320*cos(latitude) km
http://en.wikipedia.org/wiki/Latitude

Being precise, you cannot have square region on sphere surface. If you correct the distance of top 2 coordinates, then the "right" angles will not be 90 degrees and who knows if the vertical sides would be straight lines!
Google maps projection naturally gives you square in [lat, lon] 2D space, which is correct for most purposes - I also use this geographical "rectangle" grid of 11x11km squares on small spatial scales (400x200km) with no problems. If you neglect the small difference, your life will be much much easier. If you don't, I really cannot assure you the problem of exact rectangle on sphere surface even has any solution!

Related

TensorFlow Object Detection API CSV file format

Im new to using TensorFlows object detection API but understand I need to convert a csv file to a TFRecord. I understand the format of the csv should be 8 columns, as follows:
filename, width, height, class, min, xmax, ymin, ymax
what im confused about is which corner of the image is assumed to be the origin?
Thanks for any help!
The top left corner of the image is assumed to be the origin (0,0), with the width (x coordinates) increasing as you move to the right and the height (y coordinates) increasing as you move downwards.
So basically, the bottom-right corner of the image would be indexed as (width-1,height-1)
The format that you described above is basically the Pascal VOC annotation format in which, for a particular bounding box
xmin denotes the x coordinate of the top left corner
ymin denotes the y coordinate of the top left corner
xmax denotes the x coordinate of the bottom right corner
ymax denotes the y coordinate of the bottom right corner

Why is the y axis inverted in the HTML DOM and in SVG?

The y axis instead of going upwards, goes downwards, whilst the x axis has the normal sense from left to right. Why?
It is one of the most annoying obstacles when doing the graphic part of a website because the geometry has to be recalculated, as the usual calculation as in the cartesian plane will be wrong. So, why does this happen? Is there a specific reason? Did they not notice that they were betraying traditional mathematics?

Finding coordinates of the circumference of circle in pygame

in pyGame, I drew 2 circles. 1 that is stationary and one that moves with the arrow keys. So, I want the moving circle to bounce back once it touches the stationary circle( I want it to bounce off the stationary circle not the window.)
To do that I need to find the coordinates of the circumference of the stationary circle. But I do not know the specific module. Can someone suggest a module or an alternate solution.
What you actually need is to find each circles center and radius, then check the distance between the centers, if the distance is less than or equal to the two radii then you know you have a collision. I'll give an example to help:
Say you have circle A, fixed at the point (0,0) with a radius of 5px.
Circle B is at (0,10) with a radius of 3px, which is moving towards the point (0,0).
So, at first we know the distance between the two centers ((0,0) and (0,10)) is 10px, and since 10 is less than 5+3 we know the two circles are not touching.
Now at some point circle B will get to the point (0,8), at this moment when we check the distance between the circles we will get 8, which is equal to 5+3, so we have a collision.
I don't know which libraries and functions you will need to do this, but hopefully this has helped you find the right thing to search for. Basically you need to get the centers, the radii and the distance between two points (the two centers).

Google Maps API - Large Circle Extends To Gray Area Above Map

When I use the API to draw a circle near th poles, the area of the circle extends to an infinite distance in the gray area above the map. Is there a way to prevent the circle from extending into the gray area?
No, this is a property of the Mercator projection that is used to represent the Earth in 2D http://en.wikipedia.org/wiki/Mercator_projection.

Align the coordinate labels of the triangles, so that they never collide with each other. Actionscript 3

Im trying to achieve something similar to the flash movie in the below link.
http://mathopenref.com/coordtrianglearea.html
As we drag the points of the triangle, the coordinates labels, ( A(1,2)) are properly aligned and arrange themselves so that they never collide with each other and never falls inside the triangle.
Please guide me..
Thanks in advance.
in the example you gave, the textfield seems to be aligned outside the triangle on the angle bisection of the corresponding corner.
for the position in one corner, take the two vectors to the other corners. normalize them and then add them and normalize the resulting vector again. this gives you the vector v of the angle bisection in that corner. multiply the vector with a negative constant and add it to the corner, and you'll obtain a position p outside the triangle. finally, if the angle of v is between pi/2 and -pi/2 (pointing right) align the right border of the label to p, and the left border otherwise.
for simple vector calculations, please see flash.geom.Point.