Skip to main content
A newer version of this page is available. .

How to: Specify the Map Center Using Human-Readable Location Instead of Numeric Coordinates

  • 2 minutes to read

This topic describes how to access the dxMap widget directly using JavaScript code in an application created according to the Use Raster Maps tutorial. This may be required if you need to customize the widget options that are not mapped to properties of the IModelMapSettings node in the Model Editor. In this example, the center option specifying the location displayed at the center of the widget is customized using the human-readable address instead of numeric coordinates. The autoAdjust option also changed.

using DevExpress.Persistent.Base;
using DevExpress.ExpressApp.Maps.Web;
// ...
public class WebMapCenterController : ViewController {
    public WebMapCenterController() {
        TargetObjectType = typeof(IMapsMarker);
        TargetViewType = ViewType.ListView;
    }
    protected override void OnViewControlsCreated() {
        base.OnViewControlsCreated();
        WebMapsListEditor mapsListEditor = ((ListView)View).Editor as WebMapsListEditor;
        if (mapsListEditor != null) {
            mapsListEditor.MapViewer.ClientSideEvents.Customize = @"
function(sender, map) {
    map.option('center', 'Brooklyn Bridge, New York, NY');
    map.option('autoAdjust', false);
}";
        }
    }
}

The result is demonstrated in the image below.

Maps_BrooklynBridge

See Also