For example, this question discusses the calculations for a Mercator projection. And again, how you draw something on a given map at those coordinates depends very much on the map you're using.įor larger distances, the curvature of the Earth becomes important and the map projection you're working with will make a big difference in how those coordinates are calculated. For example, the coordinates you've given in your example are literally only feet apart - don't bother with complicated calculations. I want to calculate the Longitude value of those places How can I do this I have used the arctan2(y,x) formula but it is not giving the correct location. In general, the question is: how far apart are your coordinates likely to be?įor small distances, up to a few miles or kilometers, you're probably just fine treating the lat/lon as x/y coordinates. The data file contains the X Coordinates, Y Coordinates, and Latitude. If that's the case, then your calculations are going to be closely tied to the map you're using. You haven't mentioned what you're doing with this information - the mention of "frames" makes me think of animation or a game involving moving things on a map. Let posY = earthRadius * s(latRad) * Math.sin(lonRad) ĭo you know a better formula for this? Thank you very much.Īny conversion you do will introduce error, since you're trying to map the surface of a sphere to rectangular coordinates. Let posX = earthRadius * s(latRad) * s(lonRad) I've tried the following but it doesn't work: function convertSphericalToCartesian(latitude, longitude) (I assume that it is the geometry type you are using, not the geography datatype.I am doing a Javascript application that requires the movement of a certain element in a real world map, in frames.įor each frame, i have the following positions in latitude and longitude for the element, for example for frame 0:įrame (Frame 0) needs to be point (0,0) and I want the following ones to be converted to XY Coordinates as well.īasically, I need a Javascript script that receives the latitude and longitude of a frame and returns the position (x,y) for that frame (in relation to frame 0 with position (0,0)). If you want to obtain the WKB representation of a geometry, you need to use the STAsBinary() method. To answer the second(?) question, the SQL native geometry and geography datatypes are NOT WKB - they are a custom binary format that is similar to, but different from WKB. (I assume that it is the geometry type you are using, not the geography datatype.) Your best bet is to use a dedicated tool such as Safe FME (to do it. The bad news? Neither Virtual Earth nor SQL Server 2008 provide the ability to reproject spatial data. To get it back to latitude/longitude, you need to unproject it. This projection, unsurprisingly, is designed to display features in the state of Michigan with the minimal amount of distortion. All input and output linear units are in U.S. Requires use of the NGS Bluebook format for input. If you have data expressed using X and Y coordinates obtained from the State of Michigan center for geographic information () then I'm guessing it's been projected using the Michigan State Plane Coordinate System. GPPCGP (Version 2.0) Converts NAD 27 State Plane Coordinates to NAD 27 geographic positions (latitudes and longitudes) and vice versa. There are thousands of different sorts of projection, each designed to minimise distortion for a different purpose. Now, you cannot perfectly flatten a curved surface onto a flat plane without some form of distortion. All input and output linear units are in meters. This means that, once projected, you can refer to positions using Cartesian X, Y coordinates rather than Latitude and Longitude. SPCS83 (Version 2.1) Converts NAD 83 State Plane Coordinates to NAD 83 geographic positions (latitudes and longitudes) and vice versa. Projection is the process of creating a flat map from a curved model of the Earth's surface. However, in general we want maps to be flat. Angular coordinates are very useful for describing positions on a sphere (or near-sphere), like on the Earth's surface. Latitude and Longitude are angular coordinates, measured from the centre of the Earth. What you are describing is the process of 'projection' (or, specifically, 'reprojection').
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |