ThinkGeo.com    |     Documentation    |     Premium Support

Problem with CurrentExtent

Hi, I'm testing you samples, and if don't remove de CurrentExtent sentence the map is not displayed. When I remove that line, the map is displayed but with the zoom at max level. 


For other hand, if I click some button the map turns into blue backgroud and is not displayed. I have tested to remove all code from the button but the problem remains.


 


The code:


Imports System

Imports ThinkGeo.MapSuite.Core

Imports ThinkGeo.MapSuite.WebEdition



Partial Public Class _Default

    Inherits System.Web.UI.Page



    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Map1.MapBackground.BackgroundBrush = New GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"))

        Map1.CurrentExtent = New RectangleShape(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962)

        Map1.MapUnit = GeographyUnit.DecimalDegree

        Map1.MapTools.OverlaySwitcher.Enabled = True

        Map1.MapTools.MouseCoordinate.Enabled = True



        Dim yahoo As New YahooOverlay("Yahoo Map")

        yahoo.JavaScriptLibraryUri = New Uri("api.maps.yahoo.com/ajaxymap?v=3.8&appid=vrEddvTV34GIoAiUSmX5nCW4AJ3wNiefoYOH10knXAcMeU_yA44uDP_GRxOts2w-")

        yahoo.YahooMapType = YahooMapType.Regular

        If (Not Map1.CustomOverlays.Contains("Yahoo Map")) Then

            Map1.CustomOverlays.Add(yahoo)

        End If


        Dim markerOverlay As New InMemoryMarkerOverlay("Markers")

        markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.ContentHtml = "Kansas City"

        markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.HasCloseButton = True

        markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Width = 100

        markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.Popup.Height = 30

        markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20



        If Not Map1.CustomOverlays.Contains("Markers") Then

            Map1.CustomOverlays.Add(markerOverlay)

        End If



    End Sub



    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click



        Dim markerOverlay As InMemoryMarkerOverlay = DirectCast(Map1.CustomOverlays("Markers"), InMemoryMarkerOverlay)

        If Not markerOverlay.Features.ContainsKey("Kansas") Then

            markerOverlay.Features.Add("Kansas", New Feature(-94.558, 39.078))

        End If



    End Sub

End Class



Hi, 


Thanks for the post!
 
We recreated your issue when we set the system’s region to French or Germany, so can you let me know what the region setting of your system is? You can check it from “Start”-> “Control Panel” ->”Region and Language”.  There is a known bug that the web edition doesn’t work properly with some certain regions; just want to make sure if this is your case. By the way, this bug will be solved in the next beta.
 
Also, there are 2 problems in your code.
1, Map1.MapUnit = GeographyUnit.DecimalDegree;
 you should use GeographyUnit.Meter, for yahoo is projected and its unit is meter.
 
2, if you want to add markers on Yahoo Map which is projected, you need to project the MarkerOverlay you added. Code will be like following:
 
 Proj4Projection proj4 = new Proj4Projection(); 
proj4.InternalProjectionParametersString = proj4Projection.GetEpsgParametersString(4326); 
// Yahoo Map has the same projection string as GoogleMap has
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
markerOverlay.FeatureSource.Projection = proj4; 
 
And we have a sample here:
websamples.thinkgeo.com/webeditionsamples/
Markers->Add Projected Marker
 
 Ben
 

Hi,


Thank you for your reply Ben. I'm going to test your code. My system's region is Spain.



You’re welcome. We will have more test under different system environments and I think we will not have this “region” issue any more from next version.