ThinkGeo.com    |     Documentation    |     Premium Support

Map does not redraw all layers

Hello TG Folks,

I am having an issue with the map failing to draw features and overlays. Some of the time, it draws as expected. Some of the time, the wheels fall of the bus so to speak. Features that were previously drawn go missing, new features will briefly show but then disappear, overlays that haven’t changed will not draw at all, overlays with new features will not draw the new features but instead show its previous state.

I have attached images of me drawing a polygon on the map. While editing, the polygon shows just fine. When I double-click to stop editing, the polygon disappears. If I refresh the map by iterating through my overlays and “await Overlay[i].RedrawAsync().ConfigureAwait(true);”, I can see the polygon briefly, but then it disappears when the other overlays are drawn to finally show just a blank map. The data is there, but no, polygon. I have done several Redraw attempts to get the same results each time. Polygon shows briefly, but then it disappears to show a map without the polygon, and it makes me a sad panda since my customers complain that they can’t get their data to show on the map.

If I breakpoint the code, I can see the features are in the proper layers, which are in the proper overlays. So, I know the data is where it is supposed to be prior to doing a refresh. But, features and overlays won’t always show. This is a huge problem for my application since the user must refresh several times to get their data to show properly on the map if they can get it show at all. This problem is not limited to the edit overlay. I have an overlay of RasterLayers, two overlays of SQLite data, among other overlays. It is a crap shoot some of the time as to which features and overlays will actually display. Maybe I am doing something very wrong with my refresh methods, but I can’t seem to get the map to draw the current data consistently and accurately.

  1. Drawing the polygon.

  2. Done drawing the polygon

  3. during refresh

  4. Final product after refresh

edit: Polygon is still in the edit overlay. I can edit it, but it won’t show the polygon. I can clear it, and I can save it. However, none of that will change the fact that it doesn’t display on the map.

Again, this is not limited to the edit overlay nor is this the only example of the problem. It happens on all overlays except the FileRasterTileCache only overlay. That one seems to be very consistent in drawing. Sorry, I am trying to be through.

Any help would be appreciated. Thanks!

Sincerely,
Brandon Cook

P.S. Changes in the image sizes are just due to the amount of the screen I screenshotted.

Hi Brandon,

Thanks to let us know your questions.

Follow your information, I build a simple sample, it works without the problem you mentioned. For test I only add an ECW layer and open Track&Edit mode for map, then I add a click event to refresh the overlay when user click on map. I am not sure whether it’s the same like your secnario, but you can test it and modify it to shows us this issue.

9756.zip (388.1 KB)

Any question please let us know.

Regards,

Ethan

Ethan, here are two videos showing the issue. The first one shows when I click the refresh button repeatedly some features will disappear until I refresh it again. Then, a few presses later it disappears again. At 12 seconds of the first video is when I press the refresh button to have the features disappear for the first time. At 45 seconds is when the features disappear the second time. The features that disappear are in its own overlay and the layer is a SqliteDatabase layer. While this layer is the one showing the issue now, EVERY feature has displayed this issue at some point for me.

My application requires points to be updated at a steady rate of about 1 per second. The user wants to track samples taken over a large area. They have to direct the sample takers to the appropriate location in real time. If the features on the map don’t appear, they don’t know a location has been sampled.

The second video shows the edit overlay showing this issue except that I can’t get the feature to show at all, even with repeated refreshes. It is just gone. It is in the data, and the user can interact with it - however, they can’t see what they are interacting with.

I understand that the goal is to be able to reproduce the issue in the sample, but it would take a lot of time and resources for me to port everything needed to the sample in hopes that it reproduces in the sample. Hopefully, this will show the issue sufficiently to help you diagnose the issue. There are no exceptions being thrown in code that I can see. So, I can’t offer you any other leads on that front.

This is my refresh function:

public async void Refresh()
    {

        if (TGMap.IsLoaded)
        {
            List tasks = new List();            
            tasks.Add(Task.Run(() => ShpOverlay.RedrawAsync()));
            tasks.Add(Task.Run(() => ImagesOverlay.RedrawAsync()));
            tasks.Add(Task.Run(() => SqliteDbCircleOverlay.RedrawAsync()));
            tasks.Add(Task.Run(() => SqliteDbRectanglesOverlay.RedrawAsync()));
            tasks.Add(Task.Run(() => EditOverlay.RedrawAsync()));
            await Task.WhenAll(tasks);
        }
    }

When I add a feature to a particular layer within an overlay, I try to just RedrawAsync that one layer. However, it too will run into the same issue where some of the time it will be (seemingly) behind everything or it will just be gone.

I have tried implementing queue methods to try to ensure the previous draw was completed before doing the next. However, I can’t seem to shake this issue no matter what I do, which is why I am turning here for help.

Thanks again for any help you can provide. When I get a chance, I will try to start porting over some of my layers to the sample so that I can give you a simple sample to reproduce errors with.

Hi Brandon,

Thanks for you code, it helps so much, I recreated the issue showing in the first video, it’s still in progress, keep you posted on the updates.

Thanks,
Peter

Peter,

Thanks for taking a look at this. I am starting to suspect that my two issue may be related. Let me know what you find. I really appreciate your help on this! :smiley:

Sincerely,
Brandon Cook

Hey Brandon,
I worked with Peter today. We fingered out a workaround. We could add all layers to one overlay instead of have them in separate overlay. For the EditOverLay. I don’t think we need keep refresh it. And
I think we could use the build-in EditOverLay which is TGMap.EditOverlay instead of using a separate overlay.

Let me know if this work for you.

Thanks

Frank

Frank,

Thanks for the workaround. I really appreciate it. Hopefully, a full fix is coming soon since this destroys being able to group layers into overlays and adds complication to managing layers that overlays make easy. It will require restructuring the map to be a single collection of layers rather than a collection of overlays. That sucks since I expect certain layer types to be in certain overlays. But, I will do what I have to do.

For clarification, I am using the built-in edit overlay, and if there are any references to it being any different, it will be because I made an error in converting my code to the sample. I edited that block to simplify some details to make it easier to understand. For example, without my other code, TGMap wouldn’t have any context. What is that object? I didn’t want to confuse people.

The only reason that EditOverlay was added to the refresh block was because of the issue in the second video. I wanted to show that even refreshing the EditOverlay didn’t fix the issue in the second video. Also, for the purpose of debugging, being able to manually refresh the overlay would help me figure out what was going as best I could. It is the built-in TGMap.EditOverlay that you reference, but TGMap was removed to prevent confusion in that quick block. Sorry for the overly long explanation. It is in my nature to be verbose.

Thanks Brandon,
For the second issue. It may happen for some scenario. I attached my sample code to demonstrate how to draw the polygon on the build-in EditOverlay.

Load_Feature_Source.zip (2.0 KB)

Let me know if this is help. And the product team is working on the full fix for your first issue. It may come with the future release.

Thanks

Frank

Frank,

Thanks for the sample, but that is exactly what I am doing in my project. I copied it from the samples. :smiley: So, unfortunately, that did not help.

Thanks for the update, Frank. Stay safe! I hope you and the rest of the TG team are doing alright despite everything going on.

Brandon,
I am going to close this one since we will use the workaround to fix all layers not redraw issue. We will let you know once we have the new release for this issue.

Thanks
Frank

Frank,

Maybe I am misunderstanding what the situation is, and please correct me if I am. The new release will contain a fix that allows multiple overlays, but for now, just move all your layers into a single overlay. In the meantime, you are closing this topic since there is a workaround? I just want to make sure I understand what is going on.
Thanks again.

Yes,Brandon. That’s correct.

Thanks

Frank