Hi,
I need to map a substantial number of elements on a map (ie approx 50,000). Although this works, it's obviously very slow.
Instead I've developed a system which will create an image, and place dots on the image in the relevant location based on lat/long. I can then overlay this transparent image over the map.
This works fine if I have the map set to a default zoom, however as soon as I zoom in or out, the image overlayed resizes, so then all my points are out of position.
How do I change this so effectively it works in the same way as the map background, ie so when I zoom in or out, my image zooms accordingly?
Currently I'm just adding the image as an element to the map;
Dim origin As Point = MapTest.MapProjection.ProjectToMap(New Point(0,0)) 'Add image to centre Dim element As New SymbolElement() element.SymbolOrigin = origin element.Caption = "MyImage" element.SymbolType = MapSymbolType.None element.IsClickable = True element.Value = 1 --use first image from the layer MapTest.Layers("symbolLayer").Elements.Add(element) Dim worldRect As Rect = MapTest.Layers("symbolLayer").WorldRect worldRect.Union(element.WorldRect) MapTest.Layers("symbolLayer").WorldRect = worldRectThe front end has the following layer, with the image built in; <ig:MapLayer x:Name="symbolLayer"> <ig:MapLayer.ValueTemplate> <DataTemplate> <Image Width="3000" Height="2000" Source="i/MyPointsLayer.png" /> </DataTemplate> </ig:MapLayer.ValueTemplate> </ig:MapLayer>Any help appreciated.
When you say upcoming release, which do you mean? I'm using 10.3 which is the latest release, and I don't see any other service releases on the link you provided.
I've developed code which will produce a bitmap, with my points located on it relative to the map view. I can overlay this as a static image over my map, and it displays the points perfectly.
My issue is that because the image is super imposed on top of the map, and indeed the zoom/pan tool, the map is no longer accessible under the image.
I therefore thought I could simply add the image to the map as a symbol element, then do some jiggery pokery in the background every time the user zoomed or panned, to recreate and reposition the element.
I have issues with this though. When I add a symbol element with my image, I want to set the stretch to none, so it keeps its relative size. Unfortunately if I do this, the symbol simply doesn't appear. I only seem to be able to display the image using one of the other stretch formats (fill, uniform or uniform fill), which then doesn't match the map any more, unless I somehow work out exactly what size to set the element to in order for it to fit perfectly to the map view.
Here are some images which hopefully explain my point.
On my map I need to show all my customers by postcode. This is over 50,000 postcodes in the local area, and is too slow if I try adding them as elements to the map (takes 5 mins to display, then any zoom or pan takes another 5 mins to update).
I therefore developed a system which would work out my current window rectangle, create a transparent image the same size as that, and blit squares on the image relative to my postcode co-ordinates (lat and long). This works perfectly and shows as below:
This is massively faster than using individual elements (takes about 2-3 seconds to create the image on the fly and display it), so I can easily regenerate this image every time the user pans or zooms, and redisplay it over the map.
However because the image is overlaying the map, I cannot click and drag on the map, and the pan/zoom tool at the top right also has dots over it and again cannot be accessed, because the image is on top of everything else.
I therefore have to somehow get this image as part of the map. the only way I can see to do this is to create an element, allocate the image to it, and place it in the centre of my current window rectangle, while keeping the same height and width.
If I add the element with stretch.none, I simply see my map with NO image on it.
I can do stretch.uniformfill, but then the symbolsize affects the height and width of my image, which means the dots on my image are not in the correct positions on the map:
Hopefully you can see in this case the symbol size is too big, therefore the dots are too large and therefore out of position.
I can't seem to find any relation between the map size and the symbolsize of the element, so that I could work out exactly what symbol size I'd need based on the current map view, and therefore my stretch would actually fit to the current view correctly.
However as far as I'm concerned, stretch.none SHOULD display my image with the correct resolution? Instead, the image simply vanishes altogether.
Any help appreciated!
Actually, never mind, I think I've just figured out the relationship with element size to the window rectangle, take whichever is bigger out of the map actual height and actual width, divide by two, and set the symbolsize to that.
Seems to work nicely, and the redraw is actually that quick I can do it on the fly within the WindowRectChanged sub routine.
Darned sight faster than the default infragistics route anyway.
If anyone is interested I can post a runnable version somewhere. Perhaps Infragistics themselves would like to add it as a tool thinking about it, for displaying a high level of elements that do not need to be clickable or sensitive.
Thanks for your help anyway.
Hello,
I have been following this thread and am really glad to hear you got this working. I suppose the difference in performance comes from the ability to interact with the map elements unlike the image points you are going to lay over map. However, I think such a sample would be a really useful for anyone who wants to overlay the map with a projecting image.
Looking forward to looking into your approach.
Sincerely,
Petar, MCTS
Developer Support Engineer
Infragistics
www.infragistics.com/support
Hi dalereed,
I'm interested in your sample application and seeing how you solved the issue!
Can you put the sample online?
Many thanks!
Any news on this yet?
Thanks in advance!
Yeah, I'm interested in this application too!
please post it online!
Apologies all, as usual I'd moved on to other things and forgotten to upload the code!
There's quite a bit of code so I'll try and get it all split out and uploaded somewhere in the next couple of weeks.
Dale.