Weather Api (OpenWeatherMap) no wind direction(deg) - api

is there anyone using OpenWeatherMap api? , just a quick question, Im using their current condition API, but it doesnt return a wind directorion(deg) property on this lat lang (14.6760, 121.0437), it does when I input a different location, does this mean the wind is going NORTH "N if I dont receive a deg property from OpenWeatherMap?
Edit: I just noticed, its not just on that coordinates, If the wind is only at 1.5mph, it doesnt have a direction, does this mean its automatically north?

Related

How to get user location using accelerometer, gryoscope, and magnetometer in iPhone?

The simple equation for user location using inbuilt inertial measurement unit (IMU) which is also called pedestrian dead reckoning (PDR) is given as:
x= x(previous)+step length * sin(heading direction)
y= y(previous)+step length *cos(heading direction )
We can use the motionManager property of CMMotionManager class to access raw values from accelerometer, gyroscope, and magnetometer. Also, we can get attitudes values as roll, pitch, and yaw. The step length can be calculated as the double square root of acceleration. However, I'm confused with the heading direction. Some of the published literature has used a combination of magnetometer and gyroscope data to estimate the heading direction. I can see that CLHeading also gives heading information. There are some online tutorials especially for an android platform like this to estimate user location. However, it does not give any proper mathematical explanation.
I've followed many online resources like this, this,this, and this to make a PDR app. My app can detect the steps and gives the step length properly however its output is full of errors. I think the error is due to the lack of proper heading direction. I've used the following relation to get heading direction from the magnetometer.
magnetometerHeading = atan2(-self.motionManager.magnetometerData.magneticField.y, self.motionManager.magnetometerData.magneticField.x);
Similarly, from gyroscope:
grysocopeHeading +=-self.motionManager.gyroData.rotationRate.z*180/M_PI;
Finally, I give proportional weight to the previous heading driection, gryoscopeheading, and magnetometerHeading as follows:
headingDriection = (2*headingDirection/5)+(magnetometerHeading/5)+(2*gryospoceHeading/5);
I followed this method from a published journal paper. However, I'm getting lots of error in my work. Is my approach wrong? What exactly should I do to get a proper heading direction such that the localization estimation error would be minimum?
Any help would be appreciated.
Thank you.
EDIT
I noticed that while calculating heading direction using gyroscope data, I didn't multiply the rotation rate (which is in radian/sec) with the delta time. For this, I added following code:
CMDeviceMotion *motion = self.motionManager.deviceMotion;
[_motionManager startDeviceMotionUpdates];
if(!previousTime)
previousTime = motion.timestamp;
double deltaTime = motion.timestamp - previousTime;
previousTime = motion.timestamp;
Then I updated the gyroscope heading with :
gyroscopeHeading+= -self.motionManager.gryoData.rotationRate.z*deltaTime*180/M_PI;
The localization result is still not close to the real location. Is my approach correct?

Measure gps distance

Here's my problem: a smartphone will send to my server some gps coordinates (latitude,longitude,altitude) and I'll have to compare these to an address stored in db in order to see how much distance there is between smartphone and address.
I'll need to obtain this address coordinates as well in order to do the actual comparison.
Is there a good and easy to use gps library for java?Any suggestions?
In your answers please note that I need a way to get coordinates from an address too!! So, given an address "second street 2,New York, zip code 01245", I need to find latitude,longitude,altitude,ecc.
Android's Location class has a static method distanceBetween(startLatitude, startLongitude, endLatitude, endLongitude, results). You can look at the source code and use it in your program.
You could take a look at
A distance calculator using GeoCodes
Distance between 2 geocodes

CLLocation geocodeAddressString result accuracy

I'm currently working on an app where the user inputs and address, which is then converted into coords. A database of locations is then queried and locations with in, say, 5km of search location is returned.
The problem I'm having is the accuracy returned by the geocodeAddressString function. When searching: Auckland, New Zealand, I'm getting back -36.90000, 174.70000, which is about 10 km's off the correct result. It's a few suburbs over.
Is there any way to improve on this? The Google Maps result is -36.848479, 174.763373, which you can see is much sharper and what I'm after.
Thanks!

How to get reliable U.S. state responses by reverse geocoding?

Google sometimes returns the incorrect U.S. state when reverse geocoding a lat/long. Presumably this is because Google is trying to return the nearest street address, which in some cases is not in the same state as the lat/long you are trying to reverse geocode.
Though it may not be a common scenario in practice, it's pretty easy to reproduce by playing around with a map: http://gmaps-samples.googlecode.com/svn/trunk/geocoder/reverse.html
For my application, I am less concerned about getting the nearest address and more concerned about always getting the correct U.S. state for a lat/long. Is there a way to achieve this with Google's API?
Thank you
Iterate over all results and pick the one with "administrative_area_level_1" in results[i].types
This is better than taking the "equivalent" address component from the first result, i.e. finding "administrative_area_level_1" in results[0].address_components[j].types
When reverse geocoding snaps your latlng to the nearest address which happens to be in a different state (or country), the state/country address component of the first result will be that of where that address is, but the subsequent result will be the state/country where the input latlng is.
Example: 42.834185,-0.302811 is in Spain, but snaps to an address in France.
https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D42.834185%252C-0.302811
results[0].address_components[3].types = ["administrative_area_level_1", "political"]
results[0].address_components[3].short_name = "FR"
results[6].types = ["administrative_area_level_1", "political"]
results[6].short_name = "ES"

Ia there a way to get or calculate true north in cocoa touch?

I am would like to determine a direction moving x degrees clockwise starting on true north. Is there a way for me get or calculate true north based on a set of lat & long coordinates?
I am interested in implementing this cocoa touch. I am sure this is used in many of the applications already out there. Any comments, pointers, advice will be highly appreciated.
Thanks
ldj
if you get one set of coordinates, then another set say ten seconds later, you could work out which direction you had travelled in. (Not sure if this is what you wanted)
You would have to work out the change in longitude and latitude, then use a bit of trigonometry, and simple do arctan(long/lat) (arc tan is the inverse function of tan)
You'll have to avoid dividing by 0 when change in lat is 0. However, when the change in long or lat is 0 you know you have travelled directly north, east, south or west.
Also, arctan in most APIs outputs in radians so you must times it by 180 and divide by pi to get degrees.
Edit:
Is true north not located at any latitude of 0? Although my first impression this was grid north, I think due to the curve of the earth and the fact lines of longitude are drawn parallel creates variation referred to as grid north.
Do you mean magnetic north?
If so google for magnetic variation and you will have it.
Zekian is on the right path, though... It looks like you need your current long/lat, and the current magnetic poles long/lat, a bit of spherical geometry to figure out the magnetic derivation ("declination" is a word that pops up a lot), and then apply that derivation to your current magnetic north reading. And because the earth's magnetic field keeps moving around, you need to compensate for this too. Or atleast offer an update for the magnetic north's long/lat.
These are links I found along the way, but my head started spinning like in the Exorcist before I could come up with anything clever
http://www.nauticalissues.com/en/math1.html
Link
Link
http://www.ngdc.noaa.gov/geomag/magfield.shtml
http://en.wikipedia.org/wiki/Magnetic_declination