Thank you for the code suggestion. Unfortunately I’m still struggling to get these Images to display. Here is the code that builds the hospitalLayer, can you see what might be going wrong? It doesn’t produce an error, but it doesn’t display the image(s) either. InMemoryFeatureLayer hospitalLayer = new InMemoryFeatureLayer();
foreach (DataRow row in Hospitals.Rows) { PointShape point = new PointShape(Convert.ToDouble(row["longitude"]), Convert.ToDouble(row["latitude"])); ShapeValidationResult result = point.Validate(ShapeValidationMode.Simple);
Are you using a WorldMapKitLayer? If so , I think your point layer had been covered by it, please try to add the layer to the last.one in the mapPrinterLayer. Here is my map
Yes I'm using the WorldMapKitLayer, but that doesn't seem to be the answer. I removed all layers but the Hospitallayer and I still get nothing on the printpreview map.
Can you see anything else that is missing from the above code? BTW, below is a screenshot of the original map so the Hospital Markers are valid.
Sure here is the entire Method Code (BTW, I’ve just adapted the Sample, so pretty much everything else is the same as the Sample) private void AddMapLayer() { // Create the MapPrinterLayer and set the position MapPrinterLayer mapPrinterLayer = new MapPrinterLayer(); mapPrinterLayer.MapUnit = GeographyUnit.DecimalDegree; mapPrinterLayer.BackgroundMask = new AreaStyle(new GeoPen(GeoColor.StandardColors.Black, 1)); mapPrinterLayer.Open();
// Set the maps position slightly below the pages center and 8 inches wide and 7 inches tall RectangleShape pageBoundingbox = GetPageBoundingBox(PrintingUnit.Inch); mapPrinterLayer.SetPosition(8, 10, pageBoundingbox.GetCenterPoint().X, pageBoundingbox.GetCenterPoint().Y + 1, PrintingUnit.Inch);
// Setup the intial extent and ensure they snap to the default ZoomLevel ZoomLevelSet zoomLevelSet = new ZoomLevelSet();
// Add the World Map Kit layer as the background WorldMapKitLayer worldMapKitLayer = new WorldMapKitLayer(); worldMapKitLayer.Projection = WorldMapKitProjection.DecimalDegrees; mapPrinterLayer.Layers.Add(worldMapKitLayer);
if (Physicians != null) //Physicians DataTable { InMemoryFeatureLayer physicianLayer = new InMemoryFeatureLayer();
foreach (DataRow row in Physicians.Rows) { PointShape point = new PointShape(Convert.ToDouble(row["longitude"]), Convert.ToDouble(row["latitude"])); ShapeValidationResult result = point.Validate(ShapeValidationMode.Simple);
if (Hospitals != null) //Hospitals DataTable { InMemoryFeatureLayer hospitalLayer = new InMemoryFeatureLayer();
foreach (DataRow row in Hospitals.Rows) { PointShape point = new PointShape(Convert.ToDouble(row["longitude"]), Convert.ToDouble(row["latitude"])); ShapeValidationResult result = point.Validate(ShapeValidationMode.Simple);
if (DetailLayer != null) { mapPrinterLayer.Layers.Add(DetailLayer); }
// Add the MapPrinterLayer to the PrinterInteractiveOverlay
mapPrinterLayer.MapExtent = CurrentExtent; //The original Extent of the MapControl before the PrintPreview window is called; PrinterInteractiveOverLay printerInteractiveOverLay = (PrinterInteractiveOverLay)MapControl.InteractiveOverlays["PrintPreviewOverlay"]; printerInteractiveOverLay.PrinterLayers.Add("MapLayer", mapPrinterLayer); }
Oh I find the problem, the difference between your code and mine is the PointStyle’s initialization. You used the Non-parameters constructor, and after you set the image, the PointType should also be set, so please change your code to
Hi, the guys are so nice here. I am a newbie. But I have to admit that using a 3rd party tool whose way of processing is simple and fast can save a lot of time for us. I am almost a totally green hand on image converting work. I have only tried the the free trial package of an image and document conversion tool to convert images and do each step according to its tutorials about how to convert document image using C#.NET. It is just one of many but I do appreciate it because it is totally manual. Even though I only tried its free trial package and didn′t check the cost and licensing conditions, it worked great for me. But now I want to find more information about the image conversion work. Using code to do with the problem is too complicated for me, but I will try my best. Thanks for your nice information.
hello, i have an image converter c# downloaded yesterday,i can convert to various other formats, but i don’t know whether it is the source code i am needing to convert to GeImage. can any check this online image sdk for me. any help would be appreciated.
If what I guess is correct, you want to get a GeoImage with the image converter tool?
If yes, I noticed it provide a way to convert an image to stream which can be used to generate a Geoimage in MapSuite, like the below: string fileName = "c:/Sample.png"; REImage reImage = REFile.OpenImageFile(fileName); MemoryStream ms = REFile.GetStreamFromImage(reImage, new PNGEncoder()); GeoImage makrerImage = new GeoImage(ms); Or, if I misunderstand what your question, please correct me. Thanks,