Windows Phone 8 Map Overlay/Region - maps

In Windows Phone 8, using the Map control, is it possible to place a region or an overlay on top of the map that covers a certain area? Let's say for example i wish to cover the entire area of London with an overlay of some sort... the colour blue for example...
Would this be at all possible?

Yes, you can do this. The basic steps are:
Create a new MapPolygon instance (in your example this instance will be used to define the geographical boundaries of London as well as the color you want to use for the overlay)
Add the GeoCoordinate instances that define the geographical boundaries (i.e. the lat/long coordinates) for each point that defines the geographical area you want to cover to the Path property on your MapPolygon instance
Set the properties you want for the polygon (fill color, stroke color, etc)
Add your MapPolygon instance (created in step 1) to your map control's MapElements property.
You can also draw regular lines on the map using the MapPolyline class and get more fancy and put any control on top of the map (e.g. images representing various information) using the MapLayer and MapOverlay classes.

Related

Azure Maps - How to set drawing manager layers z-index to the top?

In my design page, the user will be creating/drawing new shapes, in addition to adding image overlays. I'm finding that any shapes drawn using the drawing manager are rendering underneath any image overlays added to the map, see below:
I'd like to know how to achieve a couple of tasks:
1 - How to set the drawing manager so any shape (rectangle/point/circle etc be default is always added as an upper/top layer when the drawingcomplete event has fired, that way the shapes will always appear above any images added to the map.
2 - How to programatically change the order of the various layers created during design, given the user may want to adjust the z-index of the various layers to suit their own endering requirements.
The MS docs here is not really helping me understand how to achieve the above, but also doesnt mention anything about shapes/layers that currently reside within the drawing manager.
Partial answer but along the right tracks...
We can retrieve the shapes (drawing manager layers) from the drawing manager so we have a reference to them.
When i add an image overlay, before actually adding/rendering it to the map, i would first get the shape layers from the drawing manager, then remove them from the map.
Next we add the image overlay to the map and add the shape layers back in as well, its the order that we add/remove the layers that seems to be relevant here.
Once i had added all layers back to the map in the chosen order, i was still able to put the drawing manager into edit mode and select the shape for editing, so i beleive this will work as my solution going forwards.
// Create the image layer
var imageLayer = new atlas.layer.ImageLayer({
url: 'myImageUrl,
coordinates: coordinates
})
// Then get the existing shapes (layers) from the DM
var layers = drawingManager.getLayers();
console.log(layers);
// Remove the shapes.
map.layers.remove(layers.polygonLayer); // polygonLayer as an example...
// Add new image overlay, then the shapes
map.layers.add([imageLayer, layers.polygonLayer]);

Render Visual 3D Container on top in Viewport3D

Using Helixtoolkit you have set up a scene (viewport). Added the camera, default lights, grids, etc. You also added a SortingVisual3D where you add various box elements for example. They are rendered as they are placed in the view. Everything fine.
Now I would like to achieve is to create a new container for 3D objects where my moving gizmo would be placed (every object gets one). If I add gizmo to sorting container, it might not be visible (box overlapping gizmo), so I need a separate container which has to be rendered on top of everything.
How to set container (content) to be rendered on top of everything - regardless of its physical location while still keeping it in the correct 3d space when rotating camera. Something like 3dsmax does (example).
Tnx
Ok, found the solution myself. What you want to do is to make an overlay and transform Point3D to Point and place objects there (a canvas for example).

Custom Map Image WIndows Phone 7

I have custom map image with specific height and width.
i need to map x-y coordinates of image to latitude longitude from four corner latitude longitude available.
this requirement is for fulfill current location of user into custom image map.
more on this on image i have specific few points on image, based on current position of user, i need to find near by point on image in Windows Phone Application.
Thanks in advance.
If you are using the Bing Maps Silverlight Control for WP7, there are APIs for want you want to achieve.
The Map class for example provides methods LocationToViewportPoint and ViewportPointToLocation for converting coordinates.
There is also the class MercatorUtility which provides helpful methods like LocationToLogicalPoint and LogicalPointToLocation.
However, depending on what you mean with custom map image, nobody except you would possibly know how it maps to view coordinates.

Drawing maps in WPF

I want to draw a map in WPF without using any third party controls.
I need each and every state of all the countries, and based on certain conditions I want to color them.
How can I get the polygon shapes of each state of all the countries?
Here is an SVG file with all the states as separate polygons (look at the source!)
You can convert it to xaml if you want and fill the state differently.
EDIT
Just google for svg world map. One of the first hits seems to be a nice resource.

What is the best way in Silerlight to make areas of a large graphic clickable?

In a Silverlight application I have large images which have flow charts on them.
I need to handle the clicks on specific hotspots of the image where the flow chart boxes are.
Since the flow charts will always be different, the information of where the hotspots has to be dynamic, e.g. in a list of coordinates.
I've found article like this one but don't need the detail of e.g. the outline of countries but just simple rectangle and circle areas.
I've also found articles where they talk about overlaying an HTML image map over the silverlight application, but it has to be easier than this.
What is the best way to handle clicks on specific areas of an image in silverlight?
Place the Image and a Canvas in a Grid so that the Canvas overlays the Image.
Add shapes of appropriate sizes and placed as needed to the canvas. All shapes will a transparent fill and no border, hence the user only sees the Image. On the Canvas MouseDown (or Up events) use OriginalSource to determine which shape generated the click. Use the Tag property of each shape to associate it with some object that represents the flowchart element being mapped.
I found an easy way to do this without a canvas:
How to get the coordinates of an image mouse click in the event handler?

Resources