简体   繁体   English

Telerik-ASP.Net MVC地图控件-另存为图像

[英]Telerik - ASP.Net MVC Map Control - Save As Image

I've a requirement to have a map control (with the addition of data plotting using bubbles, pins etc) to display in our website. 我需要有一个地图控件(添加使用气泡,大头针等绘制的数据)才能显示在我们的网站上。 The user should then have the ability to export this map as an image. 然后,用户应该能够将此地图导出为图像。

Does anyone know if that is possible? 有人知道这是否可能吗? I'm trying to use this control: http://www.telerik.com/aspnet-mvc/map with ASP.Net MVC5 我正在尝试使用此控件:带有ASP.Net MVC5的http://www.telerik.com/aspnet-mvc/map

If not, is there a method using other controls to do this? 如果不是,是否存在使用其他控件执行此操作的方法?

I have found below link which might helpful to you. 我发现以下链接可能对您有帮助。

Export Functionality 出口功能

Note: Please check your kendo ui version first. 注意:请先检查您的kendo ui版本。 Because all version don't provide this functionality. 因为所有版本都不提供此功能。

You can use the Kendo Drawing API for this. 您可以为此使用Kendo Drawing API。

  1. Read about the Kendo Drawing API , this should give you an idea of how it works. 阅读有关Kendo Drawing API的信息 ,这应该使您对其工作原理有所了解。 I've borrowed some code from the example we'll use in the next step. 我已从下一步中使用的示例中借用了一些代码。
  2. Visit the map demo page and open a console. 访问地图演示页面并打开控制台。 Copy and paste the code example below in your console window and hit enter. 在控制台窗口中复制并粘贴下面的代码示例,然后按Enter。 You should be prompted download an image of the map displayed. 应该提示您下载显示的地图图像。

This can be customized by changing the value in drawDOM to your own map's wrapper element. 可以通过将drawDOM中的值更改为自己的地图的wrapper元素来自定义。 Also, replace the proxyURL with your own as needed. 另外,根据需要用您自己的替换proxyURL。

    // Convert the DOM element to a drawing using kendo.drawing.drawDOM
    kendo.drawing.drawDOM($("#exampleWrap"))
    .then(function(group) {
        // Render the result as a PNG image
        return kendo.drawing.exportImage(group);
    })
    .done(function(data) {
        // Save the image file
        kendo.saveAs({
            dataURI: data,
            fileName: "example.png",
            proxyURL: "http://demos.telerik.com/kendo-ui/service/export"
        });
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM