Control map position and zoom
| 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,
M
SIGN IN To post a reply.
4 Replies
AK
Ashwin Kumaravel
Syncfusion Team
June 15, 2017 01:05 PM UTC
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
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
AK
Ashwin Kumaravel
Syncfusion Team
June 16, 2017 04:45 AM UTC
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
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
MS
June 16, 2017 04:34 PM UTC
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!
AK
Ashwin Kumaravel
Syncfusion Team
June 19, 2017 10:13 AM UTC
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
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
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
-
MS MS
- Jun 14, 2017 04:12 PM UTC
- Jun 19, 2017 10:13 AM UTC