Showing Coordinate Lines of a 3D earth - html

Here is a 3D earth made based on Three js I want to find the location of Longitude and Latitude of the currently clicked location and show the coordinate lines
What should be the strategy to define those diversion lines?
How could I map my texture to it's correct equivalent Longitude/Latitude?
Edit 1 :
My question in a simpler form:
How can I get the x, y of the pattern image which was clicked inside the sphere?

Related

Neural net: Estimate location using 6 circles

I have a problem related to detecting location of an entity on map. Say 6 devices read the location of the entity in the format of centre (x, y coronates) and radius. Just like in GPS triangulation we have to approximate the real location of the entity using this input data (x,y coronates) shown as the green pin. The issue is we have multiple/no points that 3 circles cross.
Just to formulate the problem, inputs are centres {(x1,y1)……, (x6,y6)}, corresponding radiuses {r1….. r6} and the output is {x0,y0}.
The question is can we solve this using (AI) or training a

generate layers for maps (Google or OpenLayers)

I'm trying to develop a software that gets data from a text file and generates a map layer. The map later on is going to be cut into tiles and used as overlay for Google Maps API or OpenLayers.
The data stored in the text file is weather data. The file has data about 1 x 1 squares. For example: there is .9 chance of rain for lat 1-2 and lon 5-6. I have to use the data provided in the data file and can't use pre-generated layers.
I generate the map by dividing a background white PNG into 360 horizontal boxes and 180 vertical ones and color each one based on the data available in the text file.
My problem is the fact that there are 180 latitudes and 360 longitudes but the base map for OpenLayers and Google Maps is a square. In other words, number of latitudes equals the number of longitudes in OpenLayers and Google Maps. Moreover when I take a world map and stretch it vertically the lines do not align at all.
Example:
OpenLayer base map (256px x 256px):
Generated layers (256px x 256px):
When I add the layer on top of the base map. Continents don't match. I don't have this problem when i use a non-square(256px x 128px) base map.
My question is how should I generate my layover so it works with a square world map that is being used by Google and OpenLayers?

How to translate mercator map coordinates to relative screen coordinates?

I have a database with various map locations (latitude, longitude).
I've been using a map api (e.g. google maps) to plot these locations.
I am now experimenting to see if I can totally remove dependency of map apis and simply replace the map control with an image (an .png image).
Question:
How can I translate the map locations to be displayed properly onto this map image?
More details:
Basically, the map will be a rectangular area (i.e. Div element), where the top-left corner of the rectangle is obviously (0, 0). So basically the map locations will be displayed with respect to this top-left corner.
First off, where are you getting your geocodes from? If they are from Bing or Google Maps then you can only use those coordinates with those map controls. Using this coordinates without the map controls is against the terms of use of these API's. Assuming that these coordinates come from somewhere else you can overlay them on an image by first knowing some information about the image. At a minimium you will need to know two coordinates on the image and their relative pixel locations. From that you can then determine the scale and top left coordinate of the image. With this you can then fairly accurately position coordinates on the image using a lot of math. You can find a lot of useful math for this here: http://msdn.microsoft.com/en-us/library/bb259689.aspx I've writing a few blog posts on this a while back which you can find here: http://rbrundritt.wordpress.com/2008/10/25/ve-imagery-service-and-custom-icons/
If these coordinates come from Bing Maps you can easily display them on a map image using the Bing Maps Imagery Service: http://msdn.microsoft.com/en-us/library/ff701724.aspx

KML coordinates are off in a custom Google Map?

EDIT: Turns out it was all because the coordinate translation functions in the javascript were written wrong. The author of the program has apparently fixed it.
I'm trying to use KML files to display placemarks on a custom Google Maps map. The map was generated by a Minecraft mapping program called Unmined.
My problem lies with the positioning of placemarks. They are placed on the map in a position that doesn't seem to correlate with either the pixel or latitude/longitude coordinates of the map itself.
Here is an image showing my problem.
I loaded a KML with five placemarks defined. One in the middle (0,0), one in the top-left corner (-170,80), one in the top-right corner (170,80), one in the bottom-left corner (-170,-80), and one in the bottom-right corner (170,-80). The set of markers seems to be duplicated horizontally but from my experience that's standard with Google Maps. As far as I know, the range of valid coordinates in a KML file are from -180 to 180 longitude and -90 to 90 latitude, which means that any valid placemark would have to fall somewhere inside that rectangle. Except that rectangle barely intersects the map at all.
If you need access to the code I'm using, everything can be found in the source of http://tonyfox.ws/dt/kantomap/ (URL may not exist forever)
So am I just doing something catastrophically wrong or what?
On a related note, how does Google Maps decide where to place the map in the coordinate system when the map isn't an actual Earth map (like this Minecraft world map)? My map seems to range from about 14.5 to 19.5 longitude, and 25.5 to 28 latitude. Why such weird numbers?

Calculating bounding grid coordinates to a user click on google maps/google earth

I have a requirement to calculate the centroid or geodesic midpoint of
when a user clicks in between the lat/long grid crossing.
The crossing forms a square in most parts of GE and sometimes
elongated rectangles. This is due to the shape of the earth of course.
I'm looking for a valid mathematical formula that would allow a user
to click anywhere in between this grid and then an accurate function
(in Javascript or server side code) that would take an assumed grid
resolution (say 1km intervals for this discussion) and the input
coordinates that should return a centroid coordinate within that
graticule grid.
To clarify please take a look at the attached image to my google group post:
http://google-earth-api.googlegroups.com/web/Picture+5.png?gda=h5oFPz8AAAD315KpovipQeBwdfGpmW3ZhBc9PTADwYa-n193hZ6AItFmHuno63c7phcEXYVuRA6ccyFKn-rNKC-d1pM_IdV0&gsc=sz6bbAsAAABBKF7YXWYyc4GmXg-QruHj
What I need to be able to do is if a user clicks anywhere in this grid
square, I need to find the centroid or center point of that grid
intersection/square or at least the bounding grid coordinates (that make the square).
If we assume that the grid is UTM standard and has a max resolution of
1km (or make this a parameter), I need to detect the four other points
nearby and then calculating the centroid is not as difficult.
I welcome any feedback you all may have and appreciate it.
I don't have a simple way of letting a user click anywhere on the grid and finding the grid bounding coordinates (making a square of 4 coordinates) or the centroid / midpoint of the graticule grid square necessary.
One thought is to use assumptions as much as possible using a reference such as UTM coordinate reference.
If I assume that the grid is X degrees wide, can we have a pure javascript function take any input coordinate and return for me the bounding graticule coordinates in Decimal Degrees?
Another thought I had was to create the grid in a geo-spatial layer to take any input coordinate and return the nearest centroid of the graticule?
Does this make sense?
Thanks!
Omar
this seems to be a rounding problem
1) your users click anywhere on the map
2) you want to trap the click to read out the actualLat/actualLon values
3) and round it down to the nearest discrete grid values minLat/minLon
4) then you want to calculate and return in some way the midpoint of the grid as
midLat = minLat + deltaGridLat/2;
midLon = minLon + deltaGridLon/2;
ad 2) look up the .js file in my Maidenhead locator viewer - you can surely reuse code for initializing the GE event handler and the handler for a mouse click (note I am trapping a RIGHT click)
The event handler essentially takes the user chosen location, passes it to function CoordToLoc() where the coordinates are converted to a Maidenhead locator string, which then is displayed in field inpLocator on the web page.
ad 3) this depends on your grid - if it is bound to discrete Lat/Lon values (as in my case) it's as simple as rounding. If the grid points are defined as distance offsets in km from a reference point, the simple approach would be to divide your argument by the unity length and disregard the decimal places
Hope this helps
Good luck
MikeD