Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6895751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:56:56+00:00 2026-05-27T06:56:56+00:00

I have been following this tutorial . Basically I want to take an address

  • 0

I have been following this tutorial. Basically I want to take an address from a table I have and place that address on a google map. The tutorial seems pretty straight forward, create the table places, put the behavior in and model and what not.

Just kind of confused how I’d actually use that with my existing tables. I’ve read through the section in the cookbook about behaviors but am still a little confused about them. Mostly about how I’d integrate the tutorial into other views and controllers that aren’t within place model?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:56:57+00:00Added an answer on May 27, 2026 at 6:56 am

    first you need to add latitude / longitude coordinates to your address table…

    you can do that with a writing parser around this google maps api call:

    http://maps.google.com/maps/api/geocode/xml?address=miami&sensor=false

    once your addresses contain the coordinates, all you need is to pass the coordinates
    to a javascript google maps in your view, just copy the source :

    http://code.google.com/apis/maps/documentation/javascript/examples/map-simple.html

    here is a cakephp 2.0 shell to create latitude / longitude data

    to run: “cake geo”

    GeoShell.php :

    <?php
    class GeoShell extends Shell {
    
    public $uses = array('Business');
    
    public function main() {
    
    
    
        $counter = 0;
        $unique = 0;
    
    
        $temps = $this->Business->find('all', array(
            'limit' => 100
        ));
    
        foreach($temps as $t) {
    
                $address = $this->geocodeAddress($t['Business']['address']);
    
                print_r($address);
    
                if(!empty($address)) {
                    $data['Business']['id'] = $t['Business']['id'];
                    $data['Business']['lat'] = $address['latitude'];
                    $data['Business']['lng'] = $address['longitude'];
    
                    $this->Business->save($data, false);
                    $unique++;
                }
    
        }
    
        $counter++;
    
    
        $this->out(' - Processed Records: ' . $counter . ' - ');
        $this->out(' - Inserted Records: ' . $unique . ' - ');
    
    }
    
    
    public function geocodeAddress($address) {
    
        $url = 'http://maps.google.com/maps/api/geocode/json?address=' . urlencode($address) . '&sensor=false';
    
        $response = @file_get_contents($url);
    
        if($response === false) {
            return false;
        }
    
        $response = json_decode($response);
    
        if($response->status != 'OK') {
            return false;
        }
    
        foreach ($response->results['0']->address_components as $data) {
            if($data->types['0'] == 'country') {
                $country = $data->long_name;
                $country_code = $data->short_name;
            }
        }
    
        $result = array(
            'latitude'  => $response->results['0']->geometry->location->lat,
            'longitude' => $response->results['0']->geometry->location->lng,
            'country' => $country,
            'country_code' => $country_code,
            'googleaddress' => $response->results['0']->formatted_address,
        );
        return $result;
    }
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to NHibernate... I have been following this NHibernate Tutorial from Gabriel Schenker
I have been following this Tutorial on how to read from a plist. However
I've been battling to get this right...basically I have the following HTML setup: <div
I have been following this tutorial and everything was going nice and easy until
Okay,I've been following this tutorial http://coenraets.org/blog/android-samples/androidtutorial/ Basically it gives me exactly what i need
I have been following this tutorial series for OpenGL : GLUT : http://www.lighthouse3d.com/opengl/glut/ I
i have been following this tutorial for the pagerAdapter. http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-horizontal-view-paging/ My problem is that
I am new to WP7 programming and I have been following this tutorial http://weblogs.asp.net/scottgu/archive/2010/03/18/building-a-windows-phone-7-twitter-application-using-silverlight.aspx
I have been following this tutorial. I'm having conceptual trouble at the point where
I have been learning RESTful webservices following this tutorial http://www.vogella.de/articles/REST/article.html . As I understand,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.