ThinkGeo.com    |     Documentation    |     Premium Support

Migrating from v13 to v14

Hi,

I am trying to migrate ThinkGEO XamarinForms to MAUI, it seems the implementation has changed.
Not sure what to do to make the previous code work…

  1. Setting Current Extent
    In v13, we could set the CurrentExtent as below.
    mapView.CurrentExtent = myCustomExtent;
    In v14, CurrentExtent setter seem to be hided. How could I set it in v14?

  2. Touch/Tap event
    In v13, we have below event handlers and the args is TouchMapViewEventArgs

    mapView.MapSingleTap -= mapView_MapClick;
    mapView.MapSingleTap += mapView_MapClick;

    mapView.MapDoubleTap -= mapView_MapDoubleClick;
    mapView.MapDoubleTap += mapView_MapDoubleClick;

But in v14, I think they have changed to
mapView.SingleTap -= mapView_MapClick;
mapView.SingleTap += mapView_MapClick;

mapView.DoubleTap -= mapView_MapDoubleClick;
mapView.DoubleTap += mapView_MapDoubleClick;

However, the eventArgs SingleTapMapViewEventArgs,DoubleTapMapViewEventArgs does not have property, PointInWorldCoordinate anymore. How to retrieve this property in v14?

  1. ZoomMapTool
    In v13, we could hide the zoomMapTool by
    mapView.MapTools.ZoomMapTool.IsEnabled = false;

But in v14, mapView.MapTools.ZoomMapTool is no longer exist, how could I disable the zoomMapTool?

  1. ZoomLevelSet
    In v13, we could do
    var defaultMapScale = mapView.ZoomLevelSet.ZoomLevel12.Scale;
    but in v14, ZoomLevelSet is no longer exist, how could I do the same thing?

Thank you

Hi Jimmy,

  1. In Maui, we use MapView.CenterPoint and MapView.MapScale for the extent, it’s better than CurrentExtent especially when RotationAngle is not 0.

  2. You can use the following line to convert screen coordinates to world coordinates:
    var pointInWorldCoordinate = MapView.ToWorldCoordinate(e.X, e.Y);

In fact let me write it down and we will discuss about it and may add PointInWorldCoordiante back.

  1. in Maui, you can add ZoomMapTool in xaml like following:

         <thinkgeo:MapView Grid.Row="1" x:Name="MapView" Grid.RowSpan="2" 
                           MapRotation="0" SizeChanged="MapView_OnSizeChanged">
             <thinkgeo:MapView.MapTools>
                 <thinkgeo:ZoomMapTool />
             </thinkgeo:MapView.MapTools>
         </thinkgeo:MapView>
    

ZoomMapTool is a standalone Maui component, you can just set IsVisible to show/hide it.

  1. In Maui, zoomLevelSet on MapView is a bit confusing because you can stop the map at any scale, that’s why we removed it. Now we have TileOverlay.ZoomLevelSet, which identifies the zoomlevels of the tiles, is this something you can use? Let me know your scenario and we can give you a better suggestion.

Please play with the Maui HowDoI samples : ThinkGeo / Public / Mobile Maps · GitLab, where you can find lots of good sample codes.

Thanks,
Ben