Change default map location?

  • Glenn Westfall
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 4 months ago #74202 by Glenn Westfall
Change default map location? was created by Glenn Westfall
Whenever I go to add a new event location, the default Google Map is located in Istanbul. This means each and every time I want to create a new location in my area, I have to zoom way out, drag the pin to somewhere near my location, zoom in, drag, zoom, drag, etc until I get the pin closer to where I need the event location. Is there a way to change the default location of the pin to start in my local area?

Please Log in or Create an account to join the conversation.

More
9 years 4 months ago - 9 years 4 months ago #74210 by Rupert Griffiths
Replied by Rupert Griffiths on topic Change default map location?
I had this same problem, I think the system looks for your cordinates and if it does not find them it defaults to Istanbul!

I fixed it with changing some code in the following file: components/com_eventbooking/view/location/tmpl/form.php

Lines 80 - 95:
Code:
function initialize() { geocoder = new google.maps.Geocoder(); var mapDiv = document.getElementById('map-canvas'); // Create the map object map = new google.maps.Map(mapDiv, { center: new google.maps.LatLng(<?php if(!empty($coordinates)){ echo $coordinates; } else { echo "40.992954,29.042092"; }?>), zoom: 10, mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: false }); // Create the default marker icon marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(<?php if(!empty($coordinates)){ echo $coordinates; } else { echo "40.992954,29.042092"; }?>), draggable: true });

Change the cordinates to what you want:
Code:
function initialize() { geocoder = new google.maps.Geocoder(); var mapDiv = document.getElementById('map-canvas'); // Create the map object map = new google.maps.Map(mapDiv, { center: new google.maps.LatLng(<?php if(!empty($coordinates)){ echo $coordinates; } else { echo "YOUR CORDINATES"; }?>), zoom: 10, mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: false }); // Create the default marker icon marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(<?php if(!empty($coordinates)){ echo $coordinates; } else { echo "YOUR CORDINATES"; }?>), draggable: true });
Last edit: 9 years 4 months ago by Rupert Griffiths.
The following user(s) said Thank You: Tuan Pham Ngoc

Please Log in or Create an account to join the conversation.

  • Glenn Westfall
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 4 months ago #74217 by Glenn Westfall
Replied by Glenn Westfall on topic Change default map location?
Perfect. Thank you so much!

Please Log in or Create an account to join the conversation.

More
9 years 3 months ago #75689 by Judy Akers
Replied by Judy Akers on topic Change default map location?
You could either type in the address and let the location page find the latitude and longitude.

Or you can get it from Google Maps - instructions from google
To get the coordinates of a place - first find it on the map with your browser, like Chrome, Firefox, or Internet Explorer.

Right-click the place or area on the map.
Select What's here?
A card appears at the bottom of the screen with more info.

Note: If you're using Maps in Lite mode, you won't be able to get the coordinates of a place.

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc