Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • southsouthworld Friend
    #1059109

    Hi Joomlart team,

    Instead of having the center of the map be based on the last item’s coordinates I need one certain map on my Joomla site to have a fixed coordinate set as the center.

    Link to map page is http://africa.southsouthworld.org/
    I would like it to show all of Africa and be in the center.

    My situation is unique as africa map is one of 6 maps on my site (each linked to a different sub-domain)

    Kindest regards,
    Alyssa

    southsouthworld Friend
    #1059190
    This reply has been marked as private.
    Luna Garden Moderator
    #1059446

    I’ll pass your request to the developer, he’ll back to you right after we have the solution.

    southsouthworld Friend
    #1059700

    Many thanks Luna!

    You are great.

    Mo0nlight Moderator
    #1059776

    Hi.

    You could try this.
    Edit the file:
    /plugins/system/jagooglemap/assets/script.js

    Look for:

            for(var i in locations.location) {
                var location = locations.location,
                    latitude = locations.latitude.toFloat(),
                    longitude = locations.longitude.toFloat(),
                    info = locations.info,
                    icon = null;
                if(typeof locations.icon != 'undefined') {
                    icon = locations.icon;
                }
    
                if(this.isLatLon(latitude) && this.isLatLon(longitude)){
    
                    this.showLocation2(latitude, longitude, info, icon);
                }else{
                    this.showLocation(location, info);
                }
            }

    Change to.

            for(var i in locations.location) {
                var location = locations.location,
                    latitude = locations.latitude.toFloat(),
                    longitude = locations.longitude.toFloat(),
                    info = locations.info,
                    icon = null;
                if(typeof locations.icon != 'undefined') {
                    icon = locations.icon;
                }
    
                if(this.isLatLon(latitude) && this.isLatLon(longitude)){
    
                    this.showLocation2(latitude, longitude, info, icon);
                }else{
                    this.showLocation(location, info);
                }
                centerPoint = new google.maps.LatLng(latitude,longitude);
            }
    
            var bounds = new google.maps.LatLngBounds(centerPoint);
            this.objMap.fitBounds(bounds);
    southsouthworld Friend
    #1060283

    Hi Moonlight,

    I made the changes and the map stopped working… Could you please kindly check for me to see why the code is not working.

    Kindest regards,
    Alyssa

    southsouthworld Friend
    #1060284

    Many thanks in advance for your help, look forward to hearing from you.

    Kindest regards, Alyssa

    Mo0nlight Moderator
    #1060637

    Hi.

    I edited the file:
    /plugins/system/jagooglemap/assets/script.js

    Add the code.

    this.objMap.setCenter({lat: latitude, lng:longitude });
    southsouthworld Friend
    #1060747

    Thanks, Moonlight, will this mean all the maps will have the same center? I have 6 maps on the site, and only one map I would like to have a specific center point.

    Another solution would be to base the center point of the map on the middle average point of all the map markers displayed on the map.

    Kindest regards,
    Alyssa

    Mo0nlight Moderator
    #1061102

    Hi.

    I edited the same file.

    add the code.

    if (window.location.host == 'africa.southsouthworld.org')

    You could change the host by the name you want.

    southsouthworld Friend
    #1061142

    Many thanks Moonlight so at the bottom of the code I add:

    if (window.location.host == ‘africa.southsouthworld.org’)
    this.objMap.setCenter({lat: latitude, lng:longitude });

    Mo0nlight Moderator
    #1061172

    Hi.

    I already add the code.
    You don’t have to do it.

    You could change the host "africa.southsouthworld.org" to any host you want.

Viewing 12 posts - 1 through 12 (of 12 total)

This topic contains 11 replies, has 3 voices, and was last updated by  Mo0nlight 7 years, 2 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum