How to calculate tides for specific date and location with Delphi - delphi

Just saw this question in Stack How to calculate sunrise and sunset time for current date with Delphi
Is there any way to calculate tides ? for a date and location.
Thanks

No. Sunrise and sunset is based on the simple fact that the earth is (almost) a sphere that is lit by the sun.
Tides are also based on the geographic properties on the land.
For instance the island of Great Brittain influences the tides along the Dutch and Belgian coasts because the water takes time to flow though the street of Calais.
That is why the local government publishes tides tables for most regions of the world.
See also http://www.ehow.com/how_7705476_calculate-ocean-tides.html

I don't know of any existing solutions in Delphi, but it's certainly possible.
WxTide32 is the most well known free tide program.
A good place to do some research would be
http://www.wxtide32.com/links.html

Related

Getting the estimated time of arrival between two geolocations

I'm writing a Rails backend for a mobile project and I've come across a pretty interesting problem.
I want to calculate the time of arrival between two points by car (with given points A and B) in what time A could arrive to point B. The reason why I do not take distance as a metric is because in terms of bird's eye view, the shortest distance doesn't always give you an accurate answer. Since traffic rules apply the vehicle A might be real close to point B but due to the available turns and etc. the vehicle C that is actually far more behind than the C could have a less time of arrival.
Of course using Google Maps API is the first and a pretty neat solution, however I consider that constantly querying the maps API could slow down the server, making my backend solution in efficient.
Would there be an alternative solution in order to provide an accurate time of arrival considering the real life complications such as turns, traffic and etc.
The directions service is included in the google maps API, just like geolocation. IF you can use one, you can use the other. From a google serach : https://developers.google.com/maps/documentation/directions/

How to calculate sunrise and sunset time for current date with Delphi

I need to determine sunrise and sunset times (local time) for the current day given a specific latitude and longitude and using Delphi (I am using XE2). I've found this article and used the SysTools library but the results do not agree with published tables for the UK.
Has anyone seen a pascal algorithm for this?
Some random sites:
SunTime Component
Torry's Delphi Pages
Here you can find some implementations in c, c++, pascal and others:
http://www.sci.fi/~benefon/stuff.html
For the pascal one you can go here:
http://www.sci.fi/~benefon/SUNDAY.PAS
Also, are you taking into account the daylight saving time?
Another link you could find helpfull is:
http://www.delphiarea.com/products/delphi-components/suntime/
It's a component to calculate sunrise and sunset times.
Hope this helps you.
What kind of times do you need? There are several defintions for "rise" and "sunset" (i.e. civil, nautical, astronomical). When comparing to published tables, you also need to know how those tables were calculated (geocentric position or not, standard time or true local time, and so on) and what result the used algorithms gives you. There are also some approximated algorithms using just a few terms and more precise one using much more. Also, be aware of the IEEE floating point issues, in some situations they can decrease precision a lot.
One of the best sources for such algorithms is Jean Meeus' Astronomical Algorithms (1998), 2nd edition

Is there a database of time zone lines available for download?

I've searched and found a couple of online web services that do this, but I was wondering it there's a database in the public domain which gives a list of latitudes and longitudes for the standard time zone lines? I'd like to be able to calculate what time zone a coordinate is without using a web service. I figured that time zone boundaries are mostly static and were probably decided by some committee, so there should be a CSV or GPX or KML somewhere.
I'd like to be able to check what time zone a coordinate lies in, for example:
48.856667 2.350833 is GMT+1 or CET
This is a series of files -- timezone polygons (shapefile), which you can transform into boundaries. With work on your part.
http://efele.net/maps/tz/world/
You should note that simply knowing the TZ does not guarantee that you know anything about the current correct time or date there in terms of the local calendar. Time Ex: The Isreali Knesset (parliament) decides when Daylight time starts and ends - sometimes they have chosen a date in the past. Date Ex: The Hijri Calendar changes months based on the ability of people in Mecca to actually observe the new moon from there. Cloudy days alter the date.
Askgeo.com has a Java library under commercial license. (Scroll down their page to find information about it). They charge 2 grand up front for it though, considering the amount of work they must have put in compiling loads of vector maps, etc, I can understand they want the money.
I use their free API, but you wanted something downloadable, and I think this is one of your few bets.
I tried openstreetmap and they have the data, but it would be buried in a map of Earth, not completely useful itself. Here is one on Wikipedia though: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
I recently found this data here:
https://github.com/straup/whereonearth-timezone

Guessing the time zone from an arbitrary "location" string?

I'm trying to run some statistics over the Stack Overflow data dump, and for that I would like to know the time zone for each user. However, all I have to go on is the completely free-form "location" string.
I'll stress that I'm only looking for an approximation of the time zone; of course, in general this is an unsolvable problem. However, many people fill out their country, state and/or city, which should give a pretty good indication. It's okay if it fails for other cases. It doesn't have to be reliable, it doesn't have to be accurate, it doesn't have to cover all bases.
I don't want to waste too much time on this, so I'm wondering if there is some code out there that can make a reasonable guess. Any language, platform, API or library goes. Any ideas?
Check this discussion for information on how to get the lat/lon from an arbitrary location string.
Once you have the lat/lon, you can use the web services at GeoNames to retrieve the time zone.

Are there any better geolocation databases / technologies / services or has anyone done any work with improving the accuracy of existing systems?

I am working on integrating geolocation services into a website and the best source of data I've found so far is MaxMind's GeoIP API with GeoLite City data. Even this data seems to often be questionable though. For example, I am located in downtown Palo Alto, but it locates my IP as being in Portola Valley, which is about 7 miles away. Palo Alto has a population of 60k+, whereas Portola Valley has a population of less than 5k. I would think if you see an IP originating somewhere around there it would make more sense to assume it was coming from the highly populated city, not the tiny one. I've also had it locate Palo Alto IPs completely across the country in Kentucky, etc.
Does anyone know of any better sources of data, or any tools/technologies/efforts to improve the accuracy of geolocation efforts? Commercial solutions are fine.
Where an IP comes up at the wrong end of the country, you probably won't find a better match elsewhere because it's probably an ISP that uses one group of IPs for customers in a wide area. My favourite example is trains here in the UK where the on-board wifi is identified as being in Sweden because they use a satellite connection to an ISP in Sweden.
A commercial supplier may be able to afford to spend more time tracking down the hard cases, but in many cases there just won't be a good answer to give you. They may, however, give you a confidence factor to tell you when they're guessing. I've heard good things about Quova, though I've never used them.
Assuming that you've got the best latitude and longitude that you can get (or can afford), then you're left dealing with cases where they pick the closest city rather than a more likely larger city nearby. Unfortunately I don't have the code to hand, but I had some success using the data from geonames to pick a "sensible" city near a point. They list lat/long and population, so you can do something like
ORDER BY ( Distance / LOG( Population ) )
You'd need to experiment with that to get something with the right level of bias towards larger cities, but I had it working quite nicely taking the centre of a Google Maps view and displaying a heading like "Showing results near London..." that changed as you moved the map.
I am not sure if this will help, but here is a site that has done a pretty good job of IP mapping. Maybe you could ask them for help :) seomoz.org
A couple of sites I saw referenced recently for free GeoIP services are
WIPmania
hostip.info

Resources