*

alsharif

  • ***
  • 48 posts
Listing coordinates on Google Map
« on: July 14, 2017, 10:45:15 PM »
How can I add listing Coordinates so that it gets showed on Google map? What do I need to do so?

*

MB Themes

Re: Listing coordinates on Google Map
« Reply #1 on: July 15, 2017, 07:10:14 AM »
Install google maps plugin. No coordinates are required, it is identified based on country, region and city
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

alsharif

  • ***
  • 48 posts
Re: Listing coordinates on Google Map
« Reply #2 on: July 20, 2017, 04:47:23 PM »
Dear frosticek,
Sorry if I have not been clear with my request.   
I already installed google maps and the general location is identified based on country, city. 

However, I need to provide the user with the ability to enter the House, Apartment, etc. GPS Coordinates (i.e. latitude and altitude) for their listings to be reflected on google map. Or to drag the red marker on Google map to the exact listing location, Sample photo is provided.

Thanks for your help

*

MB Themes

Re: Listing coordinates on Google Map
« Reply #3 on: July 22, 2017, 08:52:50 AM »
@alsharif
Take a look to plugin code to see what everything it accept:
Code: [Select]
function insert_geo_location($item) {
        $itemId = $item['pk_i_id'];
        $aItem = Item::newInstance()->findByPrimaryKey($itemId);
        $sAddress = (isset($aItem['s_address']) ? $aItem['s_address'] : '');
        $sCity = (isset($aItem['s_city']) ? $aItem['s_city'] : '');
        $sRegion = (isset($aItem['s_region']) ? $aItem['s_region'] : '');
        $sCountry = (isset($aItem['s_country']) ? $aItem['s_country'] : '');
        $address = sprintf('%s, %s, %s, %s', $sAddress, $sCity, $sRegion, $sCountry);
        $response = osc_file_get_contents(sprintf('http://maps.googleapis.com/maps/api/geocode/json?address=%s', urlencode($address)));
        $jsonResponse = json_decode($response);
       
        if (isset($jsonResponse->results[0]->geometry->location) && count($jsonResponse->results[0]->geometry->location) > 0) {
        $location = $jsonResponse->results[0]->geometry->location;
        $lat = $location->lat;
        $lng = $location->lng;
       
            ItemLocation::newInstance()->update (array('d_coord_lat' => $lat
                                                      ,'d_coord_long' => $lng)
                                                ,array('fk_i_item_id' => $itemId));
        }
    }
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

alsharif

  • ***
  • 48 posts
Re: Listing coordinates on Google Map
« Reply #4 on: July 22, 2017, 05:57:18 PM »
Dear Frosticek,
Please bear with me as I am still learning. 
I see that the function takes Latitude and Altitude, but how do I integrate it within your theme and how do I pass lat & lng values to the function.

*

alsharif

  • ***
  • 48 posts
Re: Listing coordinates on Google Map
« Reply #5 on: July 27, 2017, 10:13:41 PM »
I appreciate responding to my query.  Many thanks

*

alsharif

  • ***
  • 48 posts
Re: Listing coordinates on Google Map
« Reply #6 on: August 01, 2017, 09:30:33 PM »
A gentle reminder to the question that I’ve raised. Thanks

*

MB Themes

Re: Listing coordinates on Google Map
« Reply #7 on: August 03, 2017, 03:30:54 PM »
@Alsharif
I recommend to check documentation for google maps API, I do not know that information as well.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

Re: Listing coordinates on Google Map
« Reply #8 on: December 24, 2022, 12:41:22 PM »
A gentle reminder to the question that I’ve raised. Thanks


Did youu find an answer, because i faced the same issue the Coordinat elat long didn't save inta Data base