javascript 如何在bingmaps中推送2044个邮政编码而不会出现错误An expression is too long or complex to compile?

tzxcd3kk  于 2023-11-15  发布在  Java
关注(0)|答案(1)|浏览(104)

我尝试在bingmaps中创建所有荷兰(4044)邮政编码的多边形。每个邮政编码有10到1000个坐标。我尝试了以下代码,它可以处理大约200个邮政编码:

var polygoncolor = new Microsoft.Maps.Color(100, 255, 0, 0);
var  pc1011 = new Array (
new Microsoft.Maps.Location(52.372203,4.913825),
new Microsoft.Maps.Location(52.375787,4.912745),
new Microsoft.Maps.Location(52.37605,4.911752));         
var polygon1011 = new Microsoft.Maps.Polygon(pc1011  , {
            fillColor: polygoncolor,
            strokeColor: polygoncolor
        });
map.entities.push(polygon1011);

字符串
我也试过这个,这是我喜欢看到它的工作:

var myMappings = [
{  pc: "1011", coor: new Array(
     new Microsoft.Maps.Location(52.365669,4.901578),
     new Microsoft.Maps.Location(52.372203,4.913825),
     new Microsoft.Maps.Location(52.378387,4.905391)
)},
  {     
    pc: "1012", coor: new Array(
    new Microsoft.Maps.Location(52.381136,4.89783),
    new Microsoft.Maps.Location(52.372203,4.913825),
    new Microsoft.Maps.Location(52.382393,4.900011)
)}];

for (var i = 0; i < myMappings.length; i += 1) {
     var polygoncolor = new Microsoft.Maps.Color(100, 0, 0, 100);
     var polygon = new Microsoft.Maps.Polygon(myMappings[i].coor, {
       fillColor: polygoncolor,
       strokeColor: polygoncolor
     });
     map.entities.push(polygon);

}


这两个作品与有限的邮政编码.但是当我试图推动更多然后~300邮政编码/多边形与~200坐标它wil返回我下面的错误.我使用的是Visual Studio .net与bingmaps.有人知道如何解决此错误?或者也许是一个整体的其他解决方案来显示所有荷兰邮政编码?“/”应用程序中的服务器错误.
编译错误描述:编译为该请求提供服务所需的资源时出错。请查看以下特定错误详细信息并适当修改源代码。
CS 1647:表达式太长或太复杂,无法编译
错误代码:
[No相关来源]
源文件:行:0
显示详细的编译器输出:

C:\Program Files (x86)\IIS Express> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\5c6e370b\4d00bf6a_4fbad001\Owin.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\7681319b\0974f36a_4fbad001\Microsoft.Owin.Security.Facebook.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\3da77e53\b169fadb_6ebdd001\Newtonsoft.Json.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\bd686e79\7b2fc066_4fbad001\System.Web.Optimization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\f842014c\0fecca6a_4fbad001\Microsoft.Owin.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\6f59fdc9\8d4b0b6b_4fbad001\Microsoft.Owin.Security.OAuth.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\56402444\297ced66_4fbad001\System.Web.Helpers.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\8f6cdbf0\c5e7276b_4fbad001\Microsoft.Owin.Security.Twitter.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.Web.PageInspector.Loader\v4.0_1.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Web.PageInspector.Loader.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\103b82c7\dd40f266_4fbad001\System.Web.WebPages.Razor.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\b4762c60\e1aea267_4fbad001\Antlr3.Runtime.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\cd282b56\31b2b06a_4fbad001\Microsoft.AspNet.Identity.EntityFramework.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\203e57f7\3b98386b_4fbad001\Microsoft.Owin.Security.MicrosoftAccount.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\255a589c\619f9d6a_4fbad001\Microsoft.AspNet.Identity.Owin.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\c3f526d4\ebee8c6a_4fbad001\Microsoft.AspNet.Identity.Core.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\6edcd541\3d3ce677_c4c3d001\maps.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\6e7a6b7d\adad6769_4fbad001\EntityFramework.SqlServer.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\0503b2c1\4f37176b_4fbad001\Microsoft.Owin.Security.Google.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\c63f78a4\77ee4067_4fbad001\System.Web.Mvc.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\cc81fdfe\83deef66_4fbad001\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\App_global.asax.etzehoqu.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\110d2b98\cb5fff6a_4fbad001\Microsoft.Owin.Security.Cookies.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\53ac7b7e\2772c667_4fbad001\WebGrease.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Deployment\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.Deployment.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\76481f41\adad6769_4fbad001\EntityFramework.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Web.Infrastructure\v4.0_1.0.0.0__31bf3856ad364e35\Microsoft.Web.Infrastructure.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\efc86ab6\356c9c66_4fbad001\System.Web.Razor.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\0a93f772\4788e76a_4fbad001\Microsoft.Owin.Security.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\72fa3533\2b3ad96a_4fbad001\Microsoft.Owin.Host.SystemWeb.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\assembly\dl3\031deb56\dd40f266_4fbad001\System.Web.WebPages.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /out:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\App_Web_index.cshtml.a8d08dba._pu9obdf.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699;1701;612;618 /warnaserror- "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\App_Web_index.cshtml.a8d08dba._pu9obdf.0.cs" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\f424c542\388c287e\App_Web_index.cshtml.a8d08dba._pu9obdf.1.cs"

Microsoft(R)Visual C#编译器版本4.0.30319.18408
适用于Microsoft(R).NET Framework 4.5版权所有(C)Microsoft Corporation。保留所有权利。
致命错误CS1647:表达式太长或太复杂,无法编译

mgdq6dx1

mgdq6dx11#

以前没有见过这个错误。看起来像是ASP.NET中的某个东西。无论如何,尝试渲染4044个邮政编码多边形(每个多边形有200个坐标)都不会起作用。这对于JavaScript来说简直是太多的数据了。这将创建大量DOM对象,并且每次Map移动时都需要重新投影大量数据。这对用户来说也是相当大的下载量(估计超过9MB)。
也就是说,使用正确的架构,在BingMap上可视化数百万个多边形是可能的。(一堆图像)。这样浏览器一次只需要处理几张图像。这大大减少了用户必须下载的数据量。下面是我制作的一个演示,它渲染了175,000个多边形,每个多边形具有超过200个坐标:http://onsbingmapsdemo.cloudapp.net/在这个示例中,将图钉拖到多边形上以检索有关它的一些信息。我可以选择只使用鼠标单击,但我想在这个应用程序中尝试一些不同的东西。
有几种方法可以生成这些磁贴层。

相关问题