Threaded View

  1. #1
    Sencha User
    Join Date
    Aug 2012
    Vote Rating
    amritsharma is on a distinguished road


    Default Answered: How do I set the center coordinates of a map?

    xtype: 'map',
    flex: 1,
    mapOptions: {
    zoomControl: false,
    panControl: false,
    rotateControl: false,
    streetViewControl: false,
    mapTypeControl: false,
    zoom: 13

    Hi all,

    I got a map to show up in the container that I want, but I don't know how to show the map that I want. I don't mind just hard coding the coordinating... but later on, ideally use coordinates from a model.

    Let's assume, Lat and Long are X and Y. How would I tell the map or mapOptions what location I want it to show me?

    I have tried a few things, including:

    1. Adding center to mapOptions..
    center : new google.maps.LatLng(X, Y)

    2. Adding 'LatLng' or 'latitute' and 'longitude' attibutes to map and mapOptions... but im just "hoping it works" rather than have a specific strategy with it.




  2. This works for me:

    new Ext.Map({
        fullscreen : true,
        mapOptions : {
            zoomControl       : false,
            panControl        : false,
            rotateControl     : false,
            streetViewControl : false,
            mapTypeControl    : false,
            zoom              : 13,
            center            : new google.maps.LatLng(38.62452, -90.18514)
    YOu have to be careful of using namespaces in properties like config objects as the Google API must be loaded before that class is defined.