>
Geokit (Distance calculations between two points o...
Welcome, Guest

by nav on Wednesday, 15 July 2009
Geokit (Distance calculations between two points on the earth)


Hello All,

 

 

What can Geokit do for you?

·                Distance calculations between two points on the earth. Calculate the distance in miles or KM, with all the trigonometry abstracted away by Geokit.

·                ActiveRecord distance-based finders. For example, you can find all the points in your database within a 50-mile radius.

·                Geocoding from multiple providers. It supports Google, Yahoo, Geocoder.us, Geonames, Geocoder.ca, and more. Geokit provides a uniform response structure from all of them. It also provides a fail-over mechanism, in case your input fails to geocode in one service.

·                IP-based location lookup utilizing hostip.info. Provide an IP address, and get city name and latitude/longitude in return.

·                A before_filter helper to geocode the user's location based on IP address, and retain the location in a cookie.

Examples?

Find near latitude and longitude:

Store.find(:all, :origin =>[37.792,-122.393], :within=>10)

Find near an address:

Store.find(:all, :origin=>'100 Spear st, San Francisco, CA', :within=>10)

Order by distance from the center of a zipcode:

Store.find(:all, :origin=>'94117', :within=>10,
           :order=>'distance asc')

Combine distance conditions with regular conditions

Store.find(:all, :origin=>'94117', :within=>10, 
           :conditions=>{:store_type=>'CAFE'})

Geocode an address:

include Geokit::Geocoders
res=MultiGeocoder.geocode('100 Spear st, San Francisco, CA')
puts res.ll # ll=latitude,longitude

Find the address near a latitude/longitude (reverse geocoding):

include Geokit::Geocoders
res=GoogleGeocoder.reverse_geocode([37.792821,-122.393992])
puts res.full_address
>> 36-98 Mission St, San Francisco, CA 94105, USA

Find distances, headings, endpoints, and midpoints:

distance=home.distance_from(work, :units=>:miles)
heading=home.heading_to(work) # result is in degrees, 0 is north
endpoint=home.endpoint(90,2)  # two miles due east
midpoing=home.midpoint_to(work)

Test if a point is contained within bounds:

bounds=Bounds.new(sw_point,ne_point)
bounds.contains?(home)

Find within bounds:

bounds=Bounds.new(sw_point,ne_point)
Store.find :all, :bounds=>bounds

Find distance to a second location with on-the-fly geocoding:

s = Store.find(:first)
distance = s.distance_from('100 spear st, San Francisco, CA')

 

Best Regards

Naveen Butola�



Blogger Image
My Blog Title

Product Engineering, software engineering company, Product Development, Product Migration, Product Re-engineering, Product Maintenance, Product Testing Commercial Application Development, Business Software development, commercial software for startups, Application Support and Maintenance, software testing Product Maintenance, Outsource product maintenance, product support and maintenance Product Migration, Product Re-engineering, product re-engineering services Product Research, Product Engineering, UI Prototyping Services Software Testing Services, Quality Assurance services, professional software testers, Load Testing, Functional Testing, Cross Platform, Browser Testing, Test Automation, Testing Tools, software quality analysis Functional Testing Services, software quality analysis, Software Testing Services, Application Testing Services, Functional Testing Types Automated Testing, Automated Testing Services, automation testing, test script development, Automation Test Tools, outsource automation testing Load Testing, Performance Testing Services, Load Testing Tools Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Benefits of IT Outsourcing, Offshore Software Development companies, offshore software development firms Outsource planning, IT outsourcing, IT development services, offshore IT companies, offshore software development Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering