How to project a point to wgs84 crs with geographicLib - java

In my app I use a specific framework with Low-level methods that converts projected coordinates back to longitude and latitude from crs WGS84.
However, I then need to re-project these absolute values of the point with GeographicLib.
How can I take the given absolute lat long and project it to the crs wgs84?

Ok, it seems that the GeographicLib performs geographic conversions and transformations but it does not include projection to a specific CRS. To project a point to a specific CRS we can use a projection library e.g. Proj4.

Related

Google Maps Android API v2 more precise toScreenLocation() for lat lng

the projection.toScreenLocation() in API v2 returns a point containing two ints. I need more precision than that (either float, or double) as I need subsequent conversions back to latlngs from these screen coordinates to be almost exactly the same value as the original coordinates. Is there a good library or implementation of mercator projections in Java to achieve this?

How to get speed and acceleration from trajectory data?

I am using Java to develop a project. I have got some trajectory data by applying a spatial query. My question is, how can I get speed and acceleration for these trajectory data? Does java has useful library to do so?
for more information: points has (x,y,z,t)
no java has not.
speed is distance per time.
to calculate distance you can use the haversine formula, asuming x,y are in latitude longitude. z is ignored.
Depending on the plattform (e.g Android) there is a lib for that,
otherwise search for haversine distance.

Location Count issue in Java program

I a working on GPS location where i need to convert latitude and longitude in corresponding address. I have a database of all latitude and longitude(more than 1,50,000 data) with its actual landmark i.e. address in one master table.
We have installed GPS device on many vehicles which is moving across all geographic location. Every 2 minute this device sends the actual position in term of latitude and longitude, i get this latitude and longitude and maps to our Master table and check near by which landmark from our master table. For doing this calculation i do some mathematical operation to add some delta value to latitude and longitude get from vehicle and then find the nearest search from my master table, once we find we show vehicle is 5 KM from XYZ location, we get XYZ location from master table which is nearest point.
This program basically takes lot of time to calculate the location, since we have 10,000 GPS devices installed on Vehicle and every device send GPS data in 2 minute, so you may imagine how much data we do get.
Could you please help me to fix this issue and make it very scalable and fast.
Thanks in advance.
How about using a GIS layer on your db? Something like PostGIS adds a new layer to sql with just that kind of functinality. From an FAQ:
3.7. What is the best way to find all objects within a radius of another object?
To use the database most efficiently, it is best to do radius queries
which combine the radius test with a bounding box test: the bounding
box test uses the spatial index, giving fast access to a subset of
data which the radius test is then applied to.
The ST_DWithin(geometry, geometry, distance) function is a handy way
of performing an indexed distance search. It works by creating a
search rectangle large enough to enclose the distance radius, then
performing an exact distance search on the indexed subset of results.
For example, to find all objects with 100 meters of POINT(1000 1000)
the following query would work well:
SELECT * FROM geotable WHERE ST_DWithin(geocolumn, 'POINT(1000
1000)', 100.0);

coordinates based search

I am developing a web page where users can create activities and others find them via a search function. When you create an activity you must specify the exact location where it will take place, assisted by google maps I retrieve the latitude and longitude. Now, when doing a search I want to have the functionality to find all activities close to a specified location(also assisted by google maps).
So I have a set of activities with coordinates, the coordinates of a point I want to find activities nearby, and I want to return activities that are no more than, lets say, 5 km(or miles or whatever you prefer) away from this point.
I am having this idea in my head that this can be solved by calculating max/min latitude and longitude, and use these as parameters in an sql-query where I use a where clause for filtering...The problem I'm facing here is firstly calculating these max/min values, secondly in an circular area(with radius 5km), and not a rectangular
Would appreciate any input here!
Thanks!:)
Coordinates you get are probably not x and y but latitude and longitude; you will need spherical distance unless all your points are within rather small radius, e.g. few hundred miles.
If you have many points, direct exhaustive search becomes too slow, spherical or not. Fortunately, GIS extensions available both for MySQL and for Postgres. Commercial DBs also have spatial extensions. These make searches for nearby objects efficient.
Calculate the boundary latitudes and longitudes.
Use the inverse http://en.wikipedia.org/wiki/Haversine_formula
Select everything where the latitude is between your two values for that, and similarly for longitude. If you're not using a spatial index, beware of edge cases on your sphere (a most excellent pun!): crossing 0, 90, or 180 degrees may result in impossible criteria.
Either in your SQL server or your app, execute the Haversine formula against your results. You must have the rectangular bounding values to prevent a table scan, but results in the rectangle will include results outside of your circle.
If you actually stop to think about it, your rectangle and your circle are both misshapen... but that's not really relevant anyway.
Also, check out this, which will expand on distance measuring and mention some other ideas: http://www.movable-type.co.uk/scripts/gis-faq-5.1.html
Hope this can help you.
Get nearest places on Google Maps, using MySQL spatial data
However this is MySQl query. You can convert it as your requirement.

Calculate distance using google map given a latitude and longitude

I am developing a desktop application and I have two point (latitude, longitude). How can I get the distance between these two points? I have looked at the API and most of them are javascript or web based. I am not developing a web page. How can I do this in java?
I want a road distance, not a straight distance
If you've got the latitude and longitude, you can use the Haversine formula to calculate the distance between them - assuming you want "straight line" distance.
EDIT: Okay, now you've actually told us what you want, I suspect you need to use the Directions API. You'll need to make a web request to the appropriate URL with your parameters, specifying either XML or JSON output - which you'll then need to parse.
Note that "JSON" != "Javascript-based". Think of JSON as a data serialization format which just happens to be executable Javascript.
A quick Google gave me this: http://www.postalcodeworld.com/samples/distance.java.html Looks like this is a pretty good implementation of what you need using the Haversine Formula I think.
This Great Circle Distance code above is probaby OK for most apps. If you need great deal of precision, though, be aware that it may fail in some edge cases due to the earth not being a perfect sphere. In that case you're talking about more complicated algorithms.

Categories