GMAP use the google satellite layer - c#

I used in my Windows application(C#) GMAP API, I need to show the terrine feature of the map hence, I try to asssign the provider of the map as follow:
Map.MapProvider = GMapProviders.GoogleSatelliteMap;
unfortunately, the map didn't appear and show error as following:
How to get satellite view in C#??

check if you are in :
this is offline mode, it results to that if there are no caches.
GMap.NET.GMaps.Instance.Mode = GMap.NET.AccessMode.CacheOnly;
if your map's zoom property is in 0, it will result to that. do this.
MainMap.Zoom=5; //country level zoom
EDIT: another thing, this is the code to view in satellite map.
MainMap.MapProvider = GMap.NET.MapProviders.GoogleMapProvider.Instance;

Try Newer Greatmap Release in Map

You should download the lastest version of GMap.Net from here:
https://www.nuget.org/packages/GMap.NET.Presentation/

Related

How to add OpenStreetMap as background layer to my sharpmap map

I have a web application which uses sharpmap 1.1 to generate maps(Works Pretty awesome), now i want to add an Open street map as background to my current map. I tried some online examples but no luck.
So far I've tried the below.
var ShapeDataProvider = new SharpMap.Data.Providers.ShapeFile(#"Local shp Path");
var layer = new VectorLayer("test");
layer.DataSource = ShapeDataProvider;
var layerOSM = var layer = new VectorLayer("OSM");
layerOSM.DataSource = (SharpMap.Data.Providers.IProvider)(new SharpMap.Layers.TileAsyncLayer(new BruTile.Web.OsmTileSource(), "OSM"));
_map.Layers.Add(layerOSM);
_map.Layers.Add(layer);
So far I'm stuck at this error and Literally no way pass this it seems,
Argument 1: cannot convert from 'BruTile.Web.OsmTileSource' to
'BruTile.ITileSource'
The version of assemblies I'm using in my project are
Sharpmap 1.1.0.0
Brutile 0.7.4.4
ProjNet 1.3.0.3
NetTopologySuite 1.13.2.0
GeoAPI 1.7.2.0
I've added all are from Nuget, If someone could share me a piece of code which works in accessing OpenStreetMap as background layer?
that'll be a life-saver.
Thanks in advance, Cheers!
I suspect different versions of the BruTile assembly referenced in your projects.

Issues loading different shapefiles in given sharpmap tutorial code

I am currently working on sharpmap project with the need to work on offline maps. As i am fresher in this field,I am following the sharpmap tutorial and facing a problem with loading new shape files in the given tutorial code.
For Example :\
SharpMap.Layers.VectorLayer("States");
vlay.DataSource = new SharpMap.Data.Providers.ShapeFile("path_to_data\\states_ugl.shp", true);
At this line of code, if i pass a different shapefile, code builds with a blank background or no display.
I have tried with different shape files with different sizes but the result is the same. It only works for the mentioned states_ugl.shp file given in the code. Please need help regarding this issue as I am a fresher in this field.
Thanks.
Try giving layer styling for your layer, something like below.
layer.DataSource = DBlayer;
layer.Style.Fill = new SolidBrush(Color.Transparent);
layer.Style.Outline = new Pen(Color.Black);
layer.Style.EnableOutline = true;
layer.MaxVisible = 13000;

WIA 2.0 Duplex scanning

Since Vista, Windows is shipped with WIA 2.0 (wiaaut.dll).
According to the following KB article and many of my findings on various forums, duplex scanning is no longer possible using WIA 2.0. Yet, the article mentions the use of native WIA 2.0, what would make duplex scanning possible.
(https://support.microsoft.com/en-us/kb/2709992)
According to the WIA 2.0 documentation (https://msdn.microsoft.com/en-us/library/windows/desktop/ms630196(v=vs.85).aspx), duplex scanning is possible but using the new WIA_IPS_DOCUMENT_HANDLING_SELECT (3088) property.
My issues are:
I have no idea how to use native WIA, I suspect when using C# its just not possible.
I cant find a way to set the new WIA_IPS_DOCUMENT_HANDLING_SELECT property, as the property is not present in my wiaDevice properties. According to WiaDef.h, its property id is still 3088 and the only possible value is 0x400 (1024).
If anyone could help me (and I think many others) out on this, it would be much appreciated!
Greetings,
M.
After a few more hours of searching I found a clue in the following post.
https://stackoverflow.com/a/7580686/3641369
As I used a one-pass duplex scanner, both front and back sides where scanned at the same time. By setting the device properties (device properties, not item properties) Document_Handling_Select to 5 (Feeder + Duplex) and Pages to 1 and calling the transfer method 2 times, I finally got the font and back side of the scan.
Setting wiaDev.Properties["Document Handling Select"] = 5 specifies the use of the feeder and scanning duplex.
Setting wiaDev.Properties["Pages"] = 1 specifies that the scanner should keep 1 page in memory, this allowing to keep both front side and back side of the page in memory during 1 scan pass.
if (duplex)
{
wiaDev.Properties["Document Handling Select"].set_Value(5);
wiaDev.Properties["Pages"].set_Value(1);
}
Getting the Wia item and setting item properties such as color and dpi.
var item = wiaDev.Items[1];
item.Properties["6146"].set_Value((int)clr);
item.Properties["6147"].set_Value(dpi);
item.Properties["6148"].set_Value(dpi);
Then calling the transfer method twice returns two different images
var img = (ImageFile)wiaCommonDialog.ShowTransfer(item, FormatID.wiaFormatJPEG);
ImageFile imgduplex = null;
if(duplex)
imgduplex = (ImageFile)wiaCommonDialog.ShowTransfer(item, FormatID.wiaFormatJPEG);
Hope this helps someone!

Updating Application tile using TileUpdateManager

I'm developing metro app using Windows 8 release preview and C#(VS 2012),I'm using below code to update Application tile.
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
XmlDocument TileXML = TileUpdateManager.GetTemplateContent(TileTemplateType.TileWideImage);
XmlNodeList imageAttribute = TileXML.GetElementsByTagName("image");
((XmlElement)imageAttribute[0]).SetAttribute("src", "ms-appx:///Assets/Tile.png");
((XmlElement)imageAttribute[0]).SetAttribute("alt", "red graphic");
TileNotification notify = new TileNotification(TileXML);
notify.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(10);
TileUpdateManager.CreateTileUpdaterForApplication().Update(notify);
But my Application Tile is not updating, I don't know what I'm missing and where I'm doing wrong, please help me.
I got the answer, its about adding Extension file "NotificationExtensions.winmd" as my reference and also i have couple of questions
When i run above code by setting my target device as "Local
Machine" it works but when i set it to "Simulator" it doesn't, Can
any one explains me please why.
We have expiration time for tiles by using below line
notify.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(10);
what i have to do if want the live tile to be running continuously,
Please let me know if have any links or study material
Thanks in advance.
Thank you Guys,i got the answer, my image size is <200KB and < 1024x1024, mistake i did is i haven't added extension file "NotificationExtensions.winmd" as my reference. i did that and i got it.

Managed DirectX9 ColorKey

I've managed to load a texture with TextureLoader.LoadFromFile(), and provided it with Color.Black.ToArgb() for it's colorkey.
Unfortunately, when I render it, using Device.DrawUserPrimitives, I'm still seeing black.
Am I missing some code to enable the use of the ColorKey?
Needed to set some renderstate on the Device:
Device.RenderState.AlphaBlendEnable = true;
Device.RenderState.SourceBlend = Blend.SourceAlpha;
Device.RenderState.DestinationBlend = Blend.InvSourceAlpha;
I'm not certain which but I think you need to enable the render state(s) AlphaBlendEnable and/or AlphaTestEnable. You might also have to set the blend modes.
By the way, you're using Managed DirectX, which has long been discontinued. You should consider switching to XNA or SlimDX.

Categories

Resources