View Poll Results: Automated Listing Latitude & Longitude retrieval?

Voters
6. You may not vote on this poll
  • Great Idea! I can't stand wasting my time looking them up!

    6 100.00%
  • No thanks I love wasting my time manually looking it up!

    0 0%
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Add / Edit Listings... automatic Lat & Long lookup

  1. #1
    Join Date
    Nov 2009
    Posts
    66

    Lightbulb Add / Edit Listings... automatic Lat & Long lookup

    I was getting frustrated today with this... typing it in by hand on each listing after having to open a second window and copy and paste the address into a search box on geocode or google...

    So I took a few hours and researched and I found a solution for how to retrieve the information somewhat manually at the moment but with the possibility of automating it...

    That is if anyone can point me in the write direction.

    Here's what I have so far... (tested and working properly)

    PHP Code:
    // This HTML is to represent the java-script call to a child window (popup) from the add or edit listings page.

    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script>
    window.open('child.php?', 'CtrlWindow', 'width=300,height=250,top=100,left=200,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no');
    </script>
    </head>
    <body>
    <table>
        <form name="update_listing">
          <input type="text"  name="latitude" value="" size="12" />
          <input type="text"  name="longitude" value="" size="12" />
        </form>
    </body>
    </html>

    // This would be the child window that grabs the Lat & Long data, parses it and sends it back to the correct textfield.

    <?php
    // Your Google Maps API key
    $key "Your Google Map Key";

    // Desired address
    $address "http://maps.google.com/maps/geo?q=411 Woody Hayes Drive, Columbus, OH&output=xml&key=$key";

    // Retrieve the URL contents
    $page file_get_contents($address);

    // Parse the returned XML file
    $xml = new SimpleXMLElement($page);

    // Parse the coordinate string
    list($longitude$latitude$altitude) = explode(",",
    $xml->Response->Placemark->Point->coordinates);

    // Output the coordinates
    echo 'You should now see a Latitude: '.$latitude.' and Longitude: '.$longitude.' in your listing editor textfields.';
    ?>
    <script type="text/javascript">
    var myVar1 = '<?=$latitude?>';
    var myVar2 = '<?=$longitude?>';
    window.opener.document.update_listing.latitude.value = myVar1;
    window.opener.document.update_listing.longitude.value = myVar2;
    </script>
    Anyone have a little free time to explain to me how I would go about implementing this...?

    Please and thanks in advance!

  2. #2
    Join Date
    Jul 2005
    Location
    Sao Paulo, BRAZIL
    Posts
    3,763

    Default Re: Add / Edit Listings... automatic Lat & Long lookup

    Maybe this link will save you some time:
    http://www.transparent-realestate.co...arentmaps.html

    Eduardo

    Open-Realty® DOCs
    We can easily forgive a child who is afraid of the dark; the real tragedy of life is when men are afraid of the light. (Author Unknown)

  3. #3
    Join Date
    Nov 2009
    Posts
    66

    Default Re: Add / Edit Listings... automatic Lat & Long lookup

    Thanks Eduardo but not helpful for me in this case. My idea was to assist the end users of OR by speeding their clients use of OR when entering new listings... Not so much for use with mapping addons.

    Though in the future I plan to write my own addon for prospective home buyers / renters to export the gps data to their gps devices for a "Sunday Drive" style shopping of local listing, if you follow that.

    Here I digressed...

    Just looking for information on how to implement what I posted into the add / edit listings.

  4. #4
    Join Date
    Nov 2009
    Posts
    66

    Default Re: Add / Edit Listings... automatic Lat & Long lookup

    When I thought about this idea, I questioned why it was not there already... I would have thought something like this would have already been implemented.

  5. #5
    the_sandking's Avatar
    the_sandking is offline hadron remnant - Moderation Fachmann
    Join Date
    Apr 2003
    Location
    Nullspace
    Posts
    5,289

    Default Re: Add / Edit Listings... automatic Lat & Long lookup

    Quote Originally Posted by b-town View Post
    When I thought about this idea, I questioned why it was not there already... I would have thought something like this would have already been implemented.
    OR is used for things other than Real Estate, and the TransparentMaps add-on already has a feature that automatically retrieves lon/lat information. There's also a feature request area here should you have any features you think would be useful additions to OR.


    <?=$latitude?>
    Using PHP short tags is bad m'kay. You should always use <?php

    <?php echo $latitude; ?>
    Google 'php short tags' for explanations of why you should not use them.

    As far as adding this to add/edit listings, I wouldn't. I would replace OR's add/edit listings functions with an add-on. You would start by copying OR's add/edit listing functions into your add-on and then make your changes in your add-on. You would then abandon OR's add/edit listings feature and use your add-on instead.

    It's not a small task, but do-able.
    "Much of what looks like rudeness in hacker circles is not intended to give offense. Rather, it's the product of the direct, cut-through-the-BS communications style that is natural to people who are more concerned about solving problems than making others feel warm and fuzzy."

    "We gotta' go to the crappy town where I'm a hero!"
    -Hoban 'Wash' Washburne 2485-2519


    "When you’re born you get a ticket to the freak show. When you’re born in America, you get a front-row seat.."
    -George Carlin 1937-2008

    New to Open-Realty® and need help? Check the:
    -OR DOCUMENTATION -

    Important: Read this at least once in your lifetime
    How To Ask Questions The Smart Way

  6. #6
    Join Date
    Mar 2004
    Age
    98
    Posts
    207

    Default Re: Add / Edit Listings... automatic Lat & Long lookup

    Personally I use the zipdist table and pull latitude and longitude automatically from that.
    This is fine for a city or postcode which is the way most Europeans want it. That is in a add listing addon.

    <Edited> As Sandking says....</edited>
    For what you want, yahoo has a good geolocation api as well. you have to include the google or the yahoo geolocation service in an add/edit listing addon.

    Copy the Or functions from listing_editor.inc.php into your addon and modify to suit. Then redirect your links to add/edit listing to your addon.

    Very straight foirward on a site by site basis, otherwise bit more complicated allowing for different location field names as a general addon.

    If you are not using this for maps, i asume it is for the within 5 miles sort of search

    Get on with it !!
    Best,
    Rob
    Last edited by robsouthern; 12-04-2009 at 04:10 AM. Reason: just noticed i am echoing the Sandking

  7. #7
    Join Date
    Mar 2004
    Age
    98
    Posts
    207

    Default Re: Add / Edit Listings... automatic Lat & Long lookup

    In fact, why not mail me and I can give you a started edit in place on the public side addon that you could use as a base. Add in your function for pulling lat and long and use the addon to fill those fields in listingsdbelements

    You'll have it as is, and then you will not have to mofify core files Something I started and have not yet had time to finish, but if i remember, as of the moment, it works on all text and numerical fields, I have not yet written in functions to deal with fields where multiple selections are allowed.

    If you use it please keep it to yourself.

    If not, just a thought but the yahoo api will do multiple geolocations from a feed ( cant remember the format but there is an example in their debelopers' section) you could use that coupled with a small upload script pulling adress, location, location, usercb id from listingsdbelements and reuploading lat and long to update all your existing listings easily

    Best,
    Rob

  8. #8
    Join Date
    Nov 2009
    Posts
    66

    Default Re: Add / Edit Listings... automatic Lat & Long lookup

    Sorry I missed your second reply Rob, thanks everyone for the suggestions.

    Rob, send you my email via the private messaging here.

  9. #9
    Join Date
    Mar 2004
    Age
    98
    Posts
    207

    Default Re: Add / Edit Listings... automatic Lat & Long lookup

    Sending you something, this morning
    Best,
    Rob

  10. #10
    Join Date
    Nov 2009
    Posts
    66

    Thumbs up Re: Add / Edit Listings... automatic Lat & Long lookup

    Fixed and sorted!

    Thanks again Rob! Much appreciated!

    Paypal donation will be sent out soon for your much needed help!

Similar Threads

  1. Listings Editor: Lookup Order
    By repustech in forum General Help (CLOSED)
    Replies: 4
    Last Post: 07-10-2008, 10:11 PM
  2. Listings Editor does not Lookup all fields - Fixed, Not a bug
    By algebraist in forum General Help (CLOSED)
    Replies: 4
    Last Post: 01-26-2007, 06:20 PM
  3. Listings Editor Lookup feature not working properly
    By jcobb in forum General Help (CLOSED)
    Replies: 1
    Last Post: 10-05-2006, 08:51 PM
  4. Edit my listings "Lookup"
    By jormen in forum General Help (CLOSED)
    Replies: 2
    Last Post: 04-04-2006, 03:27 PM
  5. Lookup facility in "Edit all listings"
    By FranceFan in forum General Help (CLOSED)
    Replies: 2
    Last Post: 01-05-2006, 08:50 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •