We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Control map position and zoom

Thread ID:

Created:

Updated:

Platform:

Replies:

130983 Jun 14,2017 12:12 PM Jun 19,2017 06:13 AM Windows Forms 4
loading
Tags: Maps
MS
Asked On June 14, 2017 12:12 PM

     
Tags: Maps
MS
Asked On May 28, 2017 10:03 PM

Hello!
I am building a WinForms app which makes use of the Maps control. Below is the code I use to define it:

                    Maps newMapsControl1 = new Maps();
            newMapsControl1.Dock = DockStyle.Fill;
            newMapsControl1.ZoomLevel = 2;
            newMapsControl1.Margin = new Padding(0, 0, 0, 0);
            newMapsControl1.MapBackgroundBrush = new SolidBrush(
                DesignHelper.HexToColour(Properties.Settings.Default.HexMapSpaceColour));
            newMapsControl1.MapItemsShape = MapItemShapes.None;
            newMapsControl1.MapItemStroke = new SolidBrush(
                DesignHelper.HexToColour(Properties.Settings.Default.HexMapSpaceColour));
            newMapsControl1.ShapeSelected += mapsControl1_ShapeSelected;
            newMapsControl1.AnnotationDrawing += mapsControl1_AnnotationDrawing;

            ShapeFileLayer shapeLayer = new ShapeFileLayer();
            shapeLayer.Uri = "ShapeFiles/world1.shp";
            shapeLayer.EnableSelection = true;
            shapeLayer.ShapeIDPath = "Country";
            shapeLayer.ShapeIDTableField = "NAME";
            shapeLayer.ShapeSetting.ShapeValuePath = "Blocked";
            shapeLayer.ShapeSetting.ShapeColorValuePath = "Blocked";
            shapeLayer.ShapeSetting.ShapeDisplayValuePath = "NAME";
            shapeLayer.ShapeSetting.FillSetting.AutoFillColors = false;
            shapeLayer.ShowMapItem = false;
            shapeLayer.LayoutType = LayoutType.Tile;

            shapeLayer.ItemSource = viewModel.CountriesList;
            shapeLayer.Annotations = viewModel.ConnectionCoordinatesList;

            shapeLayer.ShapeSetting.SelectedShapeColor = Properties.Settings.Default.HexMapSelectedColour;
            shapeLayer.ShapeSetting.ShapeFill = Properties.Settings.Default.HexMapLandColour;
            shapeLayer.ShapeSetting.ShapeStrokeThickness = 0.5;
            shapeLayer.ShapeSetting.ShapeStroke = Properties.Settings.Default.HexForeColour;

I have used the one ShapeLayer to load the map of the world  and furthermore I have added a ColorMapping.

After I do this and add the map to the form I have noticed that  would like it to be positioned a bit more to the left with respect to the boundaries of the map control. I have tried to fiddle with margins and have taken settings one by one and tried them, but unfortunately I could not find any way to specify the map position or the map centre.

I would also like to be able to control  (set min and max) or disable completely the zoom feature of this map.

Can I get some indication how to do that?


Thank you kindly for all your help,

Ashwin Kumaravel [Syncfusion]
Replied On June 15, 2017 09:05 AM

Hi MS,

Thanks for using Syncfusion products,

We have validated you code snippet and we are able to reproduce the reported issue “Maps is not aligned at center when resizing the window in Tile View” at our end. We have logged bug report for the same.

As a work around you can remove the below line to overcome the issue,

shapeLayer.LayoutType = LayoutType.Tile;

Please refer the below link for more detail about Layout types,

https://help.syncfusion.com/windowsforms/maps/layers#layouttype

Query 2- “disable completely the zoom feature of this map

Currently we do not have support to disable the zooming feature and we have logged feature report for the same.

Regards,
Ashwin.k
 


Ashwin Kumaravel [Syncfusion]
Replied On June 16, 2017 12:45 AM

Hi MS,

We are able to reproduce the reported issue “Maps is not aligned at center when resizing the window in Tile View” at our end. We have logged bug report for the same.

As a work around you can remove the below line to overcome the issue,

shapeLayer.LayoutType = LayoutType.Tile;

Please refer the below link for more detail about Layout types,

https://help.syncfusion.com/windowsforms/maps/layers#layouttype

A support incident to track the status of this defect has been created under your account.

Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents/  

Regards,
Ashwin K

MS
Replied On June 16, 2017 12:34 PM

Hello and thank you for your answer.
I have changed the layout type and indeed it looks much closer to what I wish to see.
But I would like to be able to also programmatically set the position of the map: let me explain my use case.
I am building a geolocation application which will retrieve the user's location and show it on the map. But I want this location to be in the centre of the map at all times, how can I do that?

Thank you!


Ashwin Kumaravel [Syncfusion]
Replied On June 19, 2017 06:13 AM

Hi MS,

Thank you for your update. In our current implementation we do not have support to zoom the map based on the given coordinates.
We have considered your request as feature and logged a feature report. And a support incident to track the status of this feature has been created under your account.

Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents/  

Regards,
Ashwin

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;