Creating a resizable/draggable/rotate view in javascript

Assigning CSS with Units When you set element.style.top and element.style.left, you need to specify units (usually pixels, px, when doing this type of element transformation). In your case, you only set the units in the eventMoveHandler, which makes it only work in the move handler. In the below snippet I’ve changed it to automatically add … Read more

3D coordinates on a sphere to Latitude and Longitude

I guess it should not be difficult to find the spherical polar coordinates from x,y,z (3d-coordinate system). r is always constant if it’s on surface. (90 – θ) your latitude (negative means it’s on the bottom) as it’s measured from top. φ is your longitude. (but not quite sure about longitude system) Also check this … Read more

Convert long/lat to pixel x/y on a given picture

The key to all of this is understanding map projections. As others have pointed out, the cause of the distortion is the fact that the spherical (or more accurately ellipsoidal) earth is projected onto a plane. In order to achieve your goal, you first must know two things about your data: The projection your maps … Read more

Calculate area of polygon given (x,y) coordinates

Implementation of Shoelace formula could be done in Numpy. Assuming these vertices: import numpy as np x = np.arange(0,1,0.001) y = np.sqrt(1-x**2) We can redefine the function in numpy to find the area: def PolyArea(x,y): return 0.5*np.abs(np.dot(x,np.roll(y,1))-np.dot(y,np.roll(x,1))) And getting results: print PolyArea(x,y) # 0.26353377782163534 Avoiding for loop makes this function ~50X faster than PolygonArea: %timeit … Read more

Lat Long or Long Lat

You are correct, there is no universal standard on the order: In mathematical functions which do an universal conversion, between x,y or lon,lat or inverse, the lon,lat order should be used, because the x-axis relates to longitude and y to latitude and the x,y order is usually preferred. Further, if you program a piece of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)