News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Martynas Jusevicius' Blog:
Calculating great-circle distance in MySQL and Propel
May 01, 2008 @ 16:08:27

In a new post today, Martynas Jusevicius shows how to combine a little SQL magic with the Propel framework to fins the distance between two places:

Eventually the simple distance formula that I have blogged about turned out to be too inaccurate, even for locations within city bounds. I needed to use a formula to calculate great-circle distance which takes into account that the Earth is a sphere.

He includes the SQL to pull the data in the right format and the PHP code (using Propel) to reproduce it without having to write it by hand (complete with the bind variables to help with security and consistency).

1 comment voice your opinion now!
great circle distance mysql propel framework sql


Cyberlot's Blog:
PHP Extension creating, the quick and dirty.
January 10, 2007 @ 13:09:57

On his blog today, Richard Thomas provides his story of writing up a PHP extension "quick and dirty" for a gaming applications he's working on.

Its been a while since I last played around with extensions, not since php4 so I scanned through the manual and some only tutorials and threw together this quick and dirty guide to help you get started, again quick and dirty, not a hand holding ends all guide to making an extension, if you don't know some C and php already this is not for you.

He walks through the functionality he needed, the simple compile process of it, and the code that combines the two inputted numbers to calculate the "distance".

0 comments voice your opinion now!
extension create example compile distance extension create example compile distance


The OC Food Review Blog:
Notes on implementing location based search (part 2 of 2)
June 30, 2006 @ 12:05:41

Rahim Sonawalla has posted part two of his series on The OC Food Review blog covering the creation of a location-based search using geocoding.

We got geocoding out of the way in the first part, so now it's time to talk distances. To figure out how far apart two places are, we could use the traditional method of calculating distances between two points, but that damn Columbus didn't fall off into the Twighlight Zone when he passed the horizon. Turns out the Earth isn't flat, go figure. Oh, and since it isn't flat, assuming that it is will cause your numbers to be off when calculating distances using normal geometry-sometimes by miles.

He links to a formula for finding the difference when the distances are short as well as a PHP implementation of the Haversine formula when the distances get long.

He combines this new knowledge with the information already obtained by the geocoding in the first part and a SQL database to help narrow down the items in the list. Then, for each of those, he compares the latitude and longitudes to get the difference between them (in miles).

0 comments voice your opinion now!
location based search geocode distance between miles location based search geocode distance between miles



Community Events





Don't see your event here?
Let us know!


podcast laravel framework series zendserver symfony deployment release introduction community opinion list install package library api tips language update interview

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework