ThinkGeo.com    |     Documentation    |     Premium Support

PrinterInteractiveOverLay is not support in MVC

Hi,



  I want to Print ThinkGEOMap in PDF or Bitmap Images. 

  same functionality can available in "Map Suite Desktop Evaluation Edition 7.0" but not in  "MVC  Evaluation" 

  so, Please provide if any other way to reach this functionality.



Thanks,

Dinesh



  

Hi Dinesh, 
  
 Thanks for your post, would you please check the sample "Use PDF Extension" in "Miscellaneous" in "CSharp HowDoISamples Razor for Debug" this could provide exactly the sample you want. 
  
 if you have any more question , please feel free to let us know. 
  
 Best Regards 
  
 Summer

Hi Summer, 



Thanks for your replay, i have seen your sample “Use PDF Extension” in “Miscellaneous” in “CSharp HowDoISamples Razor for Debug” 

but there is use StaticOverlay  and we have use Customeoverlay. 



Html.ThinkGeo().Map(“Map1”, new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510) 

.MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean))) 

.CurrentExtent(-111.7875, 92.0859375, 148.36875, -93.5390625) 

.MapUnit(GeographyUnit.DecimalDegree) 

.StaticOverlay(staticOverlay => 



EcwRasterLayer worldImageLayer = new EcwRasterLayer(Server.MapPath("~/App_Data/World.ecw")); 



ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cntry02.shp")); 

worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; 

worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.StartCap = DrawingLineCap.Round; 

worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.EndCap = DrawingLineCap.Round; 

worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 





staticOverlay.Layer(“WorldImageLayer”, worldImageLayer).Layer(“WorldLayer”, worldLayer); 

}) 

.Render(); 



and My code  



@{ 

Html.ThinkGeo().Map(“Map1”, 650, 500) 

.MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")))) 

.CurrentExtent(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962) 

.MapUnit(GeographyUnit.Meter) 

.MapTools(mapTools => 



mapTools.OverlaySwitcherMapTool().Enabled(true).OnClientBaseOverlayChanged(“onLayerChanged”); 

mapTools.MouseCoordinateMapTool().Enabled(true); 

mapTools.PanZoomBarMapTool().Enabled(true); 

}) 

.CustomOverlays(overlays => 



//overlays.WorldMapKitWmsWebOverlay(); 



overlays.GoogleOverlay(“Google Map”) 

.JavaScriptLibraryUri(new Uri(ConfigurationManager.AppSettings[“GoogleUriV3”])) 

.GoogleMapType(GoogleMapType.Normal); 



InMemoryFeatureLayer shapeLayer1 = new InMemoryFeatureLayer(); 

shapeLayer1.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap; 

shapeLayer1.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image = new GeoImage(HttpContext.Current.Request.MapPath("~/Skin/Img/United States.png")); 

shapeLayer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 



overlays.LayerOverlay(“DynamicOverlay1”).Layer(“shapeLayer”, shapeLayer1).IsBaseOverlay(false).IsVisibleInOverlaySwitcher(false); ; 



InMemoryFeatureLayer shapeLayer = new InMemoryFeatureLayer(); 

shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(180, 102, 255, 102), 10, GeoColor.StandardColors.DarkGreen, 1); 

shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Green, 4, true); 

shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(180, 102, 255, 102), GeoColor.StandardColors.DarkGreen, 1); 

shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; 

shapeLayer.DrawingQuality = DrawingQuality.HighQuality;



//OpenStreet Map 

overlays.OpenStreetMapOverlay(“Open Street Map”); 

//Yahoo Map 

overlays.YahooOverlay(“Yahoo Map”).YahooMapType(YahooMapType.Regular).IsBaseOverlay(true).JavaScriptLibraryUri(new Uri(ConfigurationManager.AppSettings[“YahooUri”])); 

// Bing Map 

overlays.BingMapsOverlay(“Bing Map”).MapType(BingMapsStyle.Road); 



// WorldMap Kit 

overlays.WorldMapKitWmsWebOverlay(“WorldMapKitOverlay”).Projection(WorldMapKitProjection.SphericalMercator).Name(“ThinkGeo World Map”); 

overlays.LayerOverlay(“DynamicOverlay”).Layer(“shapeLayer”, shapeLayer).IsBaseOverlay(false).TileType(TileType.SingleTile); 

overlays.SimpleMarkerOverlay(“Assets”).DragMode(MarkerDragMode.None).IsBaseOverlay(false); 

overlays.SimpleMarkerOverlay(“WorkUnits”).DragMode(MarkerDragMode.None).IsBaseOverlay(false); 

overlays.LayerOverlay(“ManageLayer”).IsBaseOverlay(false).TileType(TileType.MultipleTile).IsVisibleInOverlaySwitcher(false); 

overlays.LayerOverlay(“LegendOverlay”).IsBaseOverlay(false).TileType(TileType.SingleTile).IsVisibleInOverlaySwitcher(false); 

overlays.SimpleMarkerOverlay(“MarkerOverlay”).DragMode(MarkerDragMode.Drag).IsBaseOverlay(false).OnClientMarkerDragged(“onClientMarkerDragged”).IsVisibleInOverlaySwitcher(false); ; 

}) 

.OnClientClick(“mapClick”) 

.Render(); 





and i want to print Googlemap,yahoo and other layers(SimpleMarkerOverlay,LayerOverlay  and DynamicOverlay). 



now i can print LayerOverlay  and DynamicOverlay as PDF.

but i cann’t print googlemap and SimpleMarkerOverlay as PDF. 




For Printing PDF my Serverside Code is Like This



     List<layeroverlay> lstlayeroverlay = new List<layeroverlay>();

     lstlayeroverlay.Add((LayerOverlay)map.CustomOverlays[“ManageLayer”]);

     lstlayeroverlay.Add((LayerOverlay)map.CustomOverlays[“DynamicOverlay”]);

     //lstlayeroverlay.Add((LayerOverlay)map.CustomOverlays[“Assets”]);

     //lstlayeroverlay.Add((LayerOverlay)map.CustomOverlays[“WorkUnits”]);

     lstlayeroverlay.Add((LayerOverlay)map.CustomOverlays[“LegendOverlay”]);

     //lstlayeroverlay.Add((LayerOverlay)map.CustomOverlays[“MarkerOverlay”]);



            Collection<simplecandidate> labelsInLayers = new Collection<simplecandidate>();

            foreach (LayerOverlay layeroverlay in lstlayeroverlay)

            {

                foreach (Layer layer in layeroverlay.Layers)

                {

                    RectangleShape printExtent = ExtentHelper.GetDrawingExtent(map.CurrentExtent, (float)map.WidthInPixels, (float)map.HeightInPixels);

                    pdfGeoCanvas.BeginDrawing(page, printExtent, GeographyUnit.DecimalDegree);

                    layer.Open();

                    layer.Draw(pdfGeoCanvas, labelsInLayers);

                    layer.Close();

                    pdfGeoCanvas.EndDrawing();

                }

            }



and i have also upload my application screen and PDF screen which we have done.



Thanks 

Dinesh 





   </simplecandidate></simplecandidate></layeroverlay></layeroverlay>

Hi Dinesh, 



Sorry we cannot directly print GoogleOverlay and SimpleMarkerOverlay to PDF by our printer class, but following should be able to provide you a walk around.

  

For SimpleMarkerOverlay, another customer had similar problem in: thinkgeo.com/forums/MapSuite/tabid/143/aft/8428/Default.aspx , it should provide you some useful information.

  

For GoogleOverlay, we suggest you to create a GoogleMapsLayer background, and print this layer instead of GoogleOverlay. 



Regards, 



Don

hi, 



Thanks for your replay, i have one issue in print when i export map to PDF than i can’t get proper PDF bec… i can’t get proper extent of map. for example i have zoom the map on “India” and export the PDF but in PDF i can’t proper result for that.

i have get same PDF in every zoom level. 



So please provide how to i get proper map extent(CurrentExtent) and map.GetBitmap() is not work in MVC. 



Thanks 

Dinesh

Hi Dinesh,



Thanks for your further information, would you please use attached vew.txt and controller.txt to replace the vew and controller for  sample  “Use PDF Extension”, now the map.GetBitmap() will work and the right extent will be exported to pdf.



if you have any more question , please feel free to let us know.



Best Regards



Summer





001_View.txt (4.06 KB)
controller.txt (2.82 KB)

hi, 
  
 Thanks for your replay, i got proper map extent(CurrentExtent).and my issue is solved.but, i can not print SimpleMarkerOverlay("MarkerOverlay") on Print PDF. 
 my code for adding SimpleMarkerOverlay on map as given below : 
  
 client side >> 
  
   @{ 
                              Html.ThinkGeo().Map("Map1", 650, 500) 
                             .MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")))) 
  
                              .CurrentExtent(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962) 
                              .MapUnit(GeographyUnit.Meter) 
                              .MapTools(mapTools => 
                              { 
                                  mapTools.OverlaySwitcherMapTool().Enabled(true).OnClientBaseOverlayChanged("onLayerChanged"); 
                                  mapTools.MouseCoordinateMapTool().Enabled(true); 
                                  mapTools.PanZoomBarMapTool().Enabled(true); 
  
                              }) 
                             .CustomOverlays(overlays => 
                             { 
                                 //overlays.WorldMapKitWmsWebOverlay(); 
  
                                 overlays.GoogleOverlay("Google Map") 
                                         .JavaScriptLibraryUri(new Uri(ConfigurationManager.AppSettings["GoogleUriV3"])) 
                                         .GoogleMapType(GoogleMapType.Normal); 
  
  
                                 overlays.SimpleMarkerOverlay("MarkerOverlay").DragMode(MarkerDragMode.Drag).IsBaseOverlay(false).OnClientMarkerDragged("onClientMarkerDragged").IsVisibleInOverlaySwitcher(false); ; 
  
                             }) 
                             .Render(); 
  
 So please help me.for printing SimpleMarkerOverlay for marker. 
  
 Thanks 
 Dinesh

Hi Denish,



Thanks for your query, with attahced code, the markeroverlay should be printed now, and here is also a result pdf for markeroverlay in the attachement for your information.



Hope it helps.



Summer.

Post11492.txt (2.89 KB)
003_002_001_MapSuite_PDF_Map.pdf (321 KB)

Hi, 





Thanks for replay, The above code which is sent for Marker on PDF  s not work properly. 



Please provide another way to Print Marker on PDF as well as Bitmap Images. 



and we can not Print YahooMap and ThinkGEO map () as PDF or Bitmap Images  



My Code as below



 @{

                        Html.ThinkGeo().Map("Map1",new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage),500)

                       .MapBackground(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"))))

                       .CurrentExtent(-13939426.6371, 6701997.4056, -7812401.86, 2626987.386962)

                       .MapUnit(GeographyUnit.Meter)


                        .MapTools(mapTools =>

                                           {

                                               mapTools.OverlaySwitcherMapTool().Enabled(true).OnClientBaseOverlayChanged("onLayerChanged");

                                               mapTools.MouseCoordinateMapTool().Enabled(true);

                                               mapTools.PanZoomBarMapTool().Enabled(true);

                                           })

                       .CustomOverlays(overlays =>

                       {

                           InMemoryFeatureLayer shapeLayer1 = new InMemoryFeatureLayer();

                           shapeLayer1.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap;

                           shapeLayer1.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image = new GeoImage(HttpContext.Current.Request.MapPath("~/Skin/Img/United States.png"));

                           shapeLayer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;



                           overlays.LayerOverlay("DynamicOverlay1").Layer("shapeLayer", shapeLayer1).IsBaseOverlay(false).IsVisibleInOverlaySwitcher(false); ;



                           GoogleMapsLayer googlelayer = new GoogleMapsLayer();

                           overlays.LayerOverlay("GoogleMap").Layer(googlelayer).IsBaseOverlay(true);



                           OpenStreetMapLayer openstreetmap = new OpenStreetMapLayer();

                           overlays.LayerOverlay("OpenStreetMap").Layer(openstreetmap).IsBaseOverlay(true);



                           BingMapsLayer bingmap = new BingMapsLayer();

                           overlays.LayerOverlay("BingMap").Layer(bingmap).IsBaseOverlay(true);



                           WorldMapKitLayer worldmap = new WorldMapKitLayer();

                           worldmap.Projection = WorldMapKitProjection.SphericalMercator; 

                           overlays.LayerOverlay("Worldmap").Layer(worldmap).IsBaseOverlay(true);  
   

                           

                           

                           InMemoryFeatureLayer shapeLayer = new InMemoryFeatureLayer();

                           shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(180, 102, 255, 102), 10,   GeoColor.StandardColors.DarkGreen, 1);

                           shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Green, 4, true);

                           shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(180, 102, 255, 102),   GeoColor.StandardColors.DarkGreen, 1);

                            shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

                           shapeLayer.DrawingQuality = DrawingQuality.HighQuality;

                        

                           overlays.LayerOverlay("DynamicOverlay").Layer("shapeLayer", shapeLayer).IsBaseOverlay(false).TileType(TileType.SingleTile);



                           overlays.SimpleMarkerOverlay("Assets").DragMode(MarkerDragMode.None).IsBaseOverlay(false);



                           overlays.SimpleMarkerOverlay("WorkUnits").DragMode(MarkerDragMode.None).IsBaseOverlay(false);



                           overlays.LayerOverlay("ManageLayer").IsBaseOverlay(false).TileType(TileType.MultipleTile).IsVisibleInOverlaySwitcher(false);



                           overlays.LayerOverlay("LegendOverlay").IsBaseOverlay(false).TileType(TileType.SingleTile).IsVisibleInOverlaySwitcher(false);



                           overlays.SimpleMarkerOverlay("MarkerOverlay").DragMode(MarkerDragMode.Drag).IsBaseOverlay(false).OnClientMarkerDragged("onClientMarkerDragged").IsVisibleInOverlaySwitcher(false); 



                           //overlays.SimpleMarkerOverlay("SimpleMarkerOverlay").DragMode(MarkerDragMode.None).IsBaseOverlay(false);

                       })

                       .Render();

                    }



In above code we have use WorldMapKitLayer for ThinkGEO map but it not load bec… we have use .MapUnit(GeographyUnit.Meter)  if we use  .MapUnit(GeographyUnit.DecimalDegree) 

than it work but we need   .MapUnit(GeographyUnit.Meter) and Print ThinkGEOmap as PDF or Bitmap.





Thanks 



Dinesh

Hi Dinesh,


Thanks for your further information.


About yahoo map, from developer.yahoo.com/maps/ we could know that the yahoo map has shut down.


About WorldMapKitLayer, with attached code it should work, and there is also a result pdf for WorldMapKitLayer on our end in the attachement for your information.


Hope it helps


Summer



post11492sample.txt (2.57 KB)
004_003_002_001_MapSuite_PDF_Map.pdf (354 KB)

Could someone please provide an example how you would create a GoogleMapsLayer for printing?  I use GoogleOverlay as my base layer and I am attempting to save to an image.  I can get my custom layers to show in the bitmap (skewed because of image size), but I do not know how to create a GoogleMapsLayer that reflects the current extent in my Controller Action Method.

Hi Thomas, 
  
 I think this topic should be helpful for this problem. 
  
 thinkgeo.com/forums/MapSuite/tabid/143/aft/11012/Default.aspx 
  
 Regards, 
  
 Don