简体   繁体   English

如何在BIRT报告中获取geoLocation

[英]How to get geoLocation in BIRT report

我正在使用BIRT报告工具生成报告。我需要显示与经度和纬度相对应的地理位置名称。在报告中,我想在表格中显示对应的地理位置名称(即:使用Google Map API)。我不需要显示Google地图。如何在BIRT报告中执行此操作。

You can insert the jsfiddle you mentionned as it is in a birt text element, see a live example of google API embedded in a BIRT report here . 您可以在birt文本元素中插入您提到的jsfiddle,请在此处查看 BIRT报告中嵌入的google API的实时示例。

Though it is important to note it makes use of a client-side geocoding API, whereas usual BIRT scripts are server-side javascripts. 尽管必须注意,它使用了客户端地理编码API,但通常的BIRT脚本是服务器端 JavaScript。 This implies limitations: 这意味着限制:

To introduce a client-side javascript in BIRT, we have to: 要在BIRT中引入客户端javascript,我们必须:

  • Insert a BIRT text element in the report 在报告中插入BIRT文本元素
  • Set the type to "HTML" in the dropdown at the top of the element 在元素顶部的下拉菜单中将类型设置为“ HTML”
  • Insert the HTML markup & Javascript code as text content 插入HTML标记和Javascript代码作为文本内容

That's quite easy, but when we get a such content through a client-side javascript, it won't be available for exports PDF, Powerpoint etc: it only appears in HTML format. 这很容易,但是当我们通过客户端javascript获得此类内容时,它将无法用于导出PDF,Powerpoint等:仅以HTML格式显示。

In order to make it available for other formats such PDF, we have to use a java geocoder API such google's , and provide relevant "jar" libraries to the BIRT engine as explained here . 为了使其可用于其他格式,PDF,我们不得不使用Java API地理编码器等谷歌的 ,并提供相关的“罐子”库添加到BIRT引擎解释这里

Some geocoding java API are free and/or open source but the geocoding services might be limited. 某些地理编码Java API是免费的和/或开源的,但是地理编码服务可能会受到限制。 Read carefully the terms of use. 仔细阅读使用条款。

据我所知,可以从BIRT工具生成的报告中调用外部Java包,因此,我的想法是您可以编写一个Java方法来调用Google地理编码API (可以从经度和纬度解析地理位置名称) ,然后从report调用java方法。

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

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