ThinkGeo.com    |     Blog    |     Wiki    |     Support

Some features disappear

Hi,
We have an issue with the mapping.
When map loads it has a lot of features in it (one for every county) and basically it looks like this:

But the problem is that after zooming after ‘redrawLayer’ is called some features sometimes disappear (image below).

The most important thing is that it happens only for Google Overlay so I think it may have something to do with projection settings.

Preparing overlay:

//google base overlay
        var google = new GoogleOverlay("Google")
        {
            GoogleMapType = GoogleMapType.Normal,

            JavaScriptLibraryUri =
                new Uri(
                    "https://maps.googleapis.com/maps/api/js?key=key&callback=initMap"),
            IsBaseOverlay = true

        };

And here’s how layer is configured with projection:

var layer = new MultipleShapeFileFeatureLayer(Directory
                    .GetFiles(layerToAdd.ShapefileFolder)
                    .Where(x => x.EndsWith(".shp")).ToList());

                //configure style (border colors) for 1-20 zoom levels 
                layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle =
                    AreaStyles.CreateSimpleAreaStyle(layerToAdd.FillColor, layerToAdd.BorderColor, 1);
                layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
               
                var overlay = new LayerOverlay(layerToAdd.Overlay)
                {
                    IsBaseOverlay = false,
                    TileType = TileType.SingleTile,
                    ServerCache = new ServerCache(layerToAdd.ShapefileFolder + "\\cache"),
                };

                if (baseOverlay == BaseOverlay.GoogleMaps)
                {
                    var proj4 = new Proj4Projection
                    {
                        ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString(),
                        InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326)
                    };
                    layer.FeatureSource.Projection = proj4;
                }
                overlay.Layers.Add(layer);
                map.CustomOverlays.Add(overlay);

Any help is greatly appreciated.

Hi Taras,

That looks is related with projection, because I hadn’t found any problem in your code, only the projection part is related with GoogleMap.

I tried to reproduce a sample based on your code but failed to reproduce that, I think maybe the data or some missed code also works for it. Could you please create a simple sample with data which can directly run and reproduce this problem? So our developer can look into it.

And please remove your key in your sample code.

Regards,

Ethan

Thanks for response Ethan.
Unfortunately it’s very hard to put together a sample out of it because there is a lot of code and dependencies so I’ll have to work on that for at least half a day.

Do you have any guesses what may cause that behavior? We’re using 9 version of Map Suite. Maybe something similar happened to anyone else?

Regards,
Taras

Hi Taras,

It looks some of your shapes disappear, but the relative position of shapes hadn’t get changed.

We hadn’t met the same problem before. If that’s an issue, we need to reproduce that first and then we can try to solve it.

In fact you don’t need reduce your project for build the sample, you can only create a simple sample, just reference ThinkGeo dll and only put map related code in it, I guess you only have two layers: BaseMap and the Green&Red layer, so the sample project won’t be complex. You just need add code from your original project till reproduce this problem in the new project. If the reason of it is from your code, this the only solution I think.

If you think that’s an issue from map control, I think maybe you can try to upgrade your dll version to latest V9 or newest V10, and see whether the latest version still can reproduce it.

Wish that’s helpful.

Regards,

Ethan