主题“jContemplater”中的问题 https://knowledge.亚搏在线safe.com/questions/topics/single/20573.html网站 “jContemplater”主题的最新问题 jContemplater显示浮点值的时间很长 https://knowledge.亚搏在线safe.com/questions/88804/jsontemplater-displaying-floats-values-go-long.html

我正在向jsonTemplater中推送我已转换为双精度数字的数据-一旦它出来,它将以0.09的形式进入,它将变得更长:“prod_index”:0.09000000000000000001

这似乎是一个浮点数舍入问题。有人能提出解决这个问题的办法吗?

多谢,

Oliver


杰森特普拉特 结婚,2019年3月20日11:51:27格林尼治标准时间 奥利弗莫里斯
将聚合器结果粘贴到JSON属性中 https://knowledge.亚搏在线safe.com/questions/86550/paste-aggregator-result-into-json-attributes.html

你好,

我对FME不熟悉,我希望得到一个格式如下的JSON文件:

“离开”:“燃烧”:533,“Autres”:30,“Risques Technologiques”:71,“Operations Diverses”:320,“意外”:411,“Secours a Personne”:3813

数据来自以下处理:

检查员给我的信息是:


我尝试使用以下治疗方法:


使用该配置:






But I can not get the desired result as above.

如果有人能帮我…?


最好的问候。

聚合器 杰森特普拉特 attributeremover JSON格式器 Thu,2019年2月7日15:08:42格林尼治标准时间 皮埃尔马克
如何将特性转换和分组为JSON输出格式 https://knowledge.亚搏在线safe.com/questions/84695/how-to-transform-and-group-features-into-json-outp.html

I have these features that I would like to transform and group into JSON output:

包装箱 包装名 资源名称 资源库
包装A 资源1 http://www.resource-a1.com
包装A 资源2 http://www.resource-a2.com
包装A 资源3 http://www.resource-a3.com
Package B 资源1 http://www.resource-b1.com
Package B 资源2 http://www.resource-B2.com
Package C 资源1 http://www.resource-c1.com
Package C 资源2 http://www.resource-c2.com
Package C 资源3 http://www.resource-C3.com
包装D 资源1 http://www.resource-D1.com


生成的数据集应包含4个功能,每个包一个功能。
For each feature or package I need an attribute containing the package data in JSON format.
例如,第一个特性的json属性值应该是:

{ ID”:“1”,“name”:“A包”,“resources”:[“name”:“资源1”,“url”:“http://www.resource-a1.com”,“name”:“资源2”,“url”:“http://www.resource-a2.com”,“name”:“资源3”,“url”:“http://www.resource-a3.com”,}

对于第二个:

{ ID”:“2”,“name”:“B包”,“resources”:[“name”:“资源1”,“url”:“http://www.resource-b1.com”,“name”:“资源2”,“url”:“http://www.resource-b2.com”]

我想我应该使用jContemplater变压器,将根模板与子模板组合,但我似乎不明白这是怎么做到的。任何帮助都将不胜感激。

json 杰森特普拉特 Sat,2018年12月29日15:40:40格林尼治标准时间 弗里斯沃德洛珀
嵌套JSON模板 https://knowledge.亚搏在线safe.com/questions/84397/nested-json-templater.html

嗨,大家好,

我需要构建一个类似于文件夹结构的嵌套JSON结构。是否可以使用JSontemplater来删除大量子模板?
我想要一些更动态的东西,或者我必须对JSON进行后期处理。

Thanks!

雅各伯

json 杰森特普拉特 嵌套的 嵌套 星期二,2018年12月18日11:37:32格林尼治标准时间 J2
JSON Validation Issue - Brackets,牙套,Commas (CONFUSED!!!) https://knowledge.亚搏在线safe.com/questions/82778/json-validation-issue-brackets-brakes-commas-confu.html(https://knowledge.safe.com/questions/82778/json-validation-issue-

Brandon_修订版.json

Brandon_修订版手册.json

你好:

我有一个问题,我似乎无法理解。我不熟悉JSON(实际上这是我创建的第一个JSON输出)。我有一个有根和子的结构。JSontemplater说我当前的结构是有效的,并生成文件。然而,当我跑过去的时候https://jsonlint.com网站/the results are invalid.所以,我查看了另一个区域期望的输出,并手动修改了文件,以查看我所做的更新是否有效。缺点是,我需要修改JSontemplater中的内容,在每个新记录之前添加一个逗号(,),并在整个输出文件周围添加括号([])。我在修改JSontemplater时所做的每一次尝试都失败了,或者我得到了一个错误。我松开了!:)我已经附上了我手动修改的文件和来自工作区实际结果的文件。


有人能告诉我我的JSontemplater出了什么问题吗?


ROOT Structure:

{
“totalinvestment”:xs:double(fme:get attribute(“totalinvestment”)),
“squarefootageretail”:xs:double(fme:get属性(“squarefootageretail”)),
“squarefootageoffice”:xs:double(fme:get属性(“squarefootageoffice”)),
“squareFootagManufacturing”:xs:double(fme:get属性(“squareFootagManufacturing”)),
“recordtype”:fme:get属性(“recordtype”),
“projectstage”:fme:get属性(“projectstage”),
“projectname”:fm:get属性(“projectname”),
“projectid”:fme:get属性(“projectid”),
"projectDescription": fme:get-attribute("projectDescription"),
“projectdate”:fme:get属性(“projectdate”),
“财产地址”:
[
FME:过程特征(“SUB”)

"programType": fme:get-attribute("programType"),
"numberOfUnits": xs:double(fme:get-attribute("numberOfUnits")),
“numberofsqft”:xs:double(fme:get属性(“numberofsqft”)),
“numberofparkingspaces”:xs:double(fme:get属性(“numberofparkingspaces”)),
“numberofhotelrooms”:xs:double(fme:get属性(“numberofhotelrooms”)),
“邻居”:fme:get属性(“邻居”),
"jobsRetained": xs:double(fme:get-attribute("jobsRetained")),
“JobsCreated”:xs:double(fme:get属性(“JobsCreated”)),
“developer”:fme:get属性(“developer”),
“类别”:fme:get属性(“类别”),
"cagisId": fme:get-attribute("cagisId"),
“地址”:fme:get属性(“地址”)。
}


子结构:

{
“street”:fme:get属性(“street”),
"cagisId": fme:get-attribute("cagisId"),
“addressID”:fm:get属性(“addressID”)
}

json 杰森特普拉特 支撑 brackets 逗号 周一,19 Nov 2018 11:50:47 GMT BCurray10
JSON编写器问题 https://knowledge.亚搏在线safe.com/questions/82650/json-writer-issue.html网站

您好:我有一个工作区,我试图用JSON编写器编写一个JSON文件。问题是,JSON的结构有一个子函数与之关联,子特性不随写操作生成。我目前使用的是文本文件编写器,它只是从我的JSonformatter中写入文本行数据。这种方法的问题在于输出是字符串,我有一些字段必须是数字。我在另一个线程上看到了使用xs:int(attribute)或xs:double(attribute)函数将字符串动态转换为int/double。这种方法很好,但是有一些数值为空,为了使用xs函数,我发现这些属性不能为空。Can't I take care of this using the JSON writer by setting the datatype of the output?But again I can't seem to get the JSON writer to generate my SUB features.

json 杰森特普拉特 JSON格式器 JSON写入器 Thu,2018年11月15日格林尼治标准时间21:34:18 BCurray10
室内地质构造错误? https://knowledge.亚搏在线safe.com/questions/82272/indoor-geojson-wrong-structure.html

VPL.TXT你好,

我想画一张室内地图,要与此传单插件一起使用,请执行以下操作:

https://www.cbaines.net/projects/osm/flealet-indoor/examples/示例/

(在这里可以找到data.json:https://github.com/cbaines/flealet-indoor/tree/master/examples/示例

输入数据是完整的室内地图,有办公室的形状文件,走廊等。每个对象都有房间号。我还有一张大桌子,上面有所有员工的名字,标题,组织,电话,还有房间号。These get joined by room number attribute with a Databasejoiner,and because some share rooms,变成了列表属性。到现在为止,一直都还不错。

我试过了,with very limited success,to use Jsontemplater.As I've worked with geojson only once or twice I'm at a loss how to continue.我写了一本杰森的书,但结构不对。Pleeeeease push me in the right direction as to setup the Jsontemplater.

(由于安全性(?)而从.json重命名为.txt)

拜托



更新:下面是结果json的一个例子(它不能被访问…人力资源管理,well).Also attached workspace and csv file with structure of DB tabl e雇员




{
“VPL”:{
“type”:“FeatureCollection”,
“特征”:
{
“type”:“功能”,
“几何学”:{
“type”:“多边形”,
“坐标”:。[
[
[11.9645998724,57.7076967993 ],
[ 11.9646165315,57.707666521,
[11.9646513205,57.7076564113],
[11.9646910265,57.7076625646],
[ 11.9646665721,57.7077068513],
[11.9645998724,57.7076967993
]
]
}
“属性”:。{
“relations”:“\”房间号:\“:\”4023\“,\“姓名”:“Jane Doe”,\“标题:\”:\“Capo di Tutti Capi\”,\“电子邮箱:jane.doe@coroleone.org\”“,
“ID”:“4023”,
“水平”:“4”
}
}
]
}
}



05_GEOJSON.fmw

吉森 杰森特普拉特 indoor FRI,2018年11月9日15:47:51格林尼治标准时间 蟾蜍
Does JSONTemplater have the ability to create buckets? https://knowledge.亚搏在线safe.com/questions/79800/does-jsontemplater-have-the-ability-to-create-buck.html

大家下午好,

我正在尝试从SQL创建一个大型嵌套JSON文档,以加载到MongoDB中。Currently I have managed to create the JSON file but i'm not able to load it into Mongo based on the size of the documents.文档的最大大小为16MB,而我的平均文档大小超过50MB。

我想到的一个解决方案是将每个子文件都存储起来,这样就不需要在每个根目录中嵌入数千个文档,而是最大限制为500个,然后用相同的根目录创建一个新文档,但子文件的延续。In the end instead of a single 50MB document I would be left with say 10 identical documents that would hold different Sub documents from one another.然后我可以使用$unwind查询10个文档集,以便它将它们作为一个单独的文档进行分类。

Does anyone know of a way to achieve this within FME Workbench instead of loading all sub documents into a root?

json 数据库 杰森特普拉特 Thu,2018年10月4日13:31:50格林尼治标准时间 主要工作
如何使用XQuery创建JSON LineString? https://knowledge.亚搏在线safe.com/questions/76218/how-do-i-use-xquery-to-create-a-json-linestring.html

我的目标是创建一个与以下模板匹配的JSON文件。我一直在努力使LineString几何属性中的坐标格式正确。Note the addition of the "tippecanoe" property.

“type”:“功能”,“tippecanoe”:“maxzoom”:9,"minzoom" : 4 },"properties" : { "FULLNAME" : "N Vasco Rd" },“geometry”:“type”:“linestring”,“坐标”:[-121.733350,37.767671 ],[ -121.733600,37.767483,[-121.733 131,37.766952]_

我试过的东西:

  • 基本地质构造作者-在“properties”下写入maxoom/minzoom属性,而不是“tippecanone”。
  • 杰森特普拉特-
concat(“[”,geom:get points(“xy”),',','],['),']]')

这种方法有效,but feels hackish;它添加了引号(“)我稍后将其删除。

gem:获取文本数据(gem:get-name())

第二个方法返回空值。我用geometrypropertiester给几何命名,但仍然返回空值。If someone can post a working example,我可以从那里走。The documentation is little light.谢谢您!

杰森特普拉特 Sat,2018年8月11日格林威治标准时间18:35:38 贾斯丁马提斯
JSON模板程序不等待子模板 https://knowledge.亚搏在线safe.com/questions/70997/json-templater-doesnot-wait-for-sub-templates.html

I'm facing a strange situation in v2017.1


我有一个相当复杂的JSON模板,使用多个子模板,joining several inputs on a "group sub-features by"

输出的大多数子模板都被路由为“无”,当我看着它处理的时候,I realized the JSON Tempater started outputting some features even before receiving a single input from some of the sub-templates inputs streams.(处理时间较长,从数据库中检索几个附加数据,then using python to pivot some data and generate list of json elements itself to nest in the main json)


How is that even possible?它不是像其他的接线变压器一样等待提供给它的所有东西吗?

杰森特普拉特 接合 flow control Thu,24 May 2018 14:05:52 GMT 弗查梅尔
在geojson中强制转换为整数 https://knowledge.亚搏在线safe.com/questions/70124/casting-to-integer-in-geojson.html

是否有任何原因导致fme不使用xs:int将值强制转换为整数?(价值)?

我不断地得到:

"xs:string": invalid value for cast/constructor: can not cast to "xs:int"

传入值是来自gml文件的12位数字,类型为:xml_int64

i try it without the cast and the JSONTemplator works but it comes out as a string when i need it as an integer.

json 杰森特普拉特 整数 FRI,2018年5月11日10:55:18格林尼治标准时间 巴兹纽曼07
JSontemplater呈现空大括号而不是空大括号? https://knowledge.亚搏在线safe.com/questions/61345/jsontemplater-render-empty-brakes-instead-of-null.html

在下面的示例中,JSON模板似乎将呈现空值:

“test”:u result'具有值“test”:空

是否可以让它按原样呈现空大括号?

谢谢。

json 杰森特普拉特 结婚,2018年1月10日03:37:56格林尼治标准时间 彼得克斯
使用JSontemplater的JSON支持 https://knowledge.亚搏在线safe.com/questions/51738/json-support-using-jsontemplater.html

I am trying to generate a JSON file that includes elements like this one:

但我对“位置”属性有问题。I can´t reproduce it.我可以获取和排列([]而不是)以及每个元素,如“9”:[220000,3230000]开头和结尾都不需要。

我附上整个项目(jsontemplater.zip)我需要的target.json。

事先谢谢。

杰森特普拉特 星期二,2017年8月29日13:58:58格林尼治标准时间 J4
JSON转换:使用JSonextractor提取,JSonFlatener和JSonFragmenter https://knowledge.亚搏在线safe.com/articles/45081/json-transformations.html

关于使用FME与JSON合作的介绍,请看教程:JSON入门.

介绍

在FME中,有许多方法可以操纵JSON来提取所需的数据。在本文中,我们将介绍三种不同的变压器,并重点介绍它们的用途,我是一个很好的朋友,JSONextractor,以及jsonfragcenter。在第一个例子中,我们将使用jsonflattener和jsonextractor从metaweather的JSONAPI提要中提取天气信息。In the second example,我们将获取在上一篇文章并使用JSonFragCenter将其分割成包含多个记录的单个属性。


下载

网址:https://www.metaweather.com/api/location/9807/

jsentansformations.zip文件


示例1:阅读简单消息

We will read a JSON message from the Meta Weather website and then extract the weather status.使用httpcaller创建的响应主体属性,我们可以使用jsonFlatener将其扁平化,以公开这些属性。属性提取的另一种方法是选择要查询的特定JSON元素。To do this,我们将使用jsonextractor提取weather子元素来查看今天的天气。

1。添加创建者转换器

Open FME Workbench and start a blank workspace,将创建者转换器添加到画布。


2。Add an HTTPCaller transformer

Click on the Creator and add an HTTPCaller transformer.The Creator will trigger the HTTPCaller to get information from the URL.在httpcaller参数中,paste in the following the URL for the Request URL and set the HTTP Method to GET:

网址:https://www.metaweather.com/api/location/9807/

这个网址是温哥华的;如果您想在自己的城市中遵循这个例子,你可以查一下Woeid然后替换URL末尾的数字字符串。

Requesting the URL containing weather data from the Meta Weather API using the HTTPCaller


三。选择要保留的属性

我们只想保留httpcaller的响应主体属性,这是您在Web浏览器中打开URL时看到的JSON。向httpCaller添加attributekeeper转换器。In the parameter set the Attributes to Keep to _response_body and click ok.


4。使用jsonFlatener创建属性

If you run and inspect the JSON after the AttributeKeeper,in there are only 4 attributes and no individual attributes for the weather status,温度,等。So to access these we need to flatten the JSON.添加一个JSonFlatener Transformer,并为JSON文档选择响应主体。现在,如果您运行并检查JSON,响应主体有139个属性,包含我们所需要的所有信息,只需将它们分割成各个部分。


5.提取JSON以查找今天的天气

不是将JSON扁平化为一组属性,如果我们对一个元素或属性感兴趣,我们可以将其提取到一个属性中。为了找到今天的天气,我们需要提取父元素并公开子元素。将JSonextractor转换器连接到httpCaller,在参数中,将源JSON文档设置为响应主体,然后将目标属性设置为天气。对于JSON查询,enter json["consolidated_weather"][0]["weather_state_name"] this will extract the parent element called consolidated_weather,然后提取第一个数组(即0),然后打电话给那个叫天气州的孩子。这个API为我们提供了5天的预测,但我们只对今天的天气感兴趣,这就是为什么只调用第一个数组的原因。


下一步,we need to extract the temperature,在同一个jsonextractor中,将另一个target属性设置为temperature,然后将json查询设置为json[“合并的天气”[0][“温度”]。如果您想调用所有5天的预测,可以使用[*]而不是[0]。单击“确定”保存查询。

JSON查询的语法,在jsonextractor中查询天气


查找查询以访问天气信息可能很困难。您可以仔细查看数据检查器中的属性,并注意这个结构:

或者,另一种查找查询的方法是将FeatureReader临时添加到画布并在JSON URL中读取。单击参数并将模式扫描模式设置为“JSON查询”。然后在查询下,单击“…”以公开JSON树。在树中展开json,then expand consolidated_weather,然后点击下面的儿童天气州名称。Copy the JSON query that is indicated in the Selected Item box,这个查询与我们输入到JSonextractor中的查询相同。复制此查询后,可以删除FeatureReader。

使用FeatureReader和查询树获取正确的JSON查询语法


6.检查数据

将检查器连接到JSonextractor并运行转换。在数据检查器中,you can see that the weather_state_name and the_temp attributes are exposed.当您运行这个翻译时,天气的类型会有所不同,因为它是一个活动的JSON提要。

当前天气提取的JSON输出


示例2:提取复杂消息

在前面的示例中,我们读取JSON并使用JSonFlatener和JSonextractor检查输出。只是回顾一下,jsonfrattener将扁平化json并公开响应主体内的属性。The JSONExtractor extracts attributes using a JSON query and creates it's own attribute outside of the _response_body attribute.在这个例子中,我们将在此基础上使用更嵌套的JSON,并提取纬度和经度来创建点。


1。使用文本文件阅读器读取JSON

在空白工作区中,或者在前一个工作区的另一个部分中,添加文本文件读取器。读取在中创建的vantraffic.json文件JSON编写概述article.In the parameters set Read Whole File at Once to yes,单击确定。我们使用文本文件阅读器而不是JSON阅读器来读取JSON数据的原因是,我们希望JSON包含在一个名为text_line_data的属性中。如果我们使用JSON阅读器读取JSON,每一行都将是包含在其自身属性中的单独记录,including the brackets.


2。添加一个JSonFragCenter,将JSON分解为单独的属性。

Connect a JSONFragmenter to the Text File reader.在参数中,将json属性设置为text_line_data,并将json查询设置为json[“features”][*],您可以通过前一个示例中所述的方法获得此语法,通过浏览到json树并选择json>features>array values,以及复制语法。然后将扁平查询结果改为属性Yes,然后确保递归展平对象/数组设置为“是”。

使用JSonFragCenter和JSON查询分割JSON



三。公开感兴趣的属性

添加一个attributeexposer变压器,在参数中输入以下属性:

属性.标题
属性.publishedDate
属性.linkurl
属性。内容
属性ID
FMEX几何{0 }
类型
几何.坐标
几何类型


我们可以在attributeexposer参数中输入父元素或子元素,包括数组,与坐标对的情况一样。

使用attributeExposer公开的属性,公开父元素和子元素



4。从暴露的属性创建点

使用VertexCreator变压器,在参数中,将x值设置为属性几何体。坐标,在“列表元素选择”对话框中,输入0作为坐标。这将读取数组中的第一个坐标,这是经度值。对y值重复此操作,selecting 1 for the coordinates to read the second coordinate in the array,这是纬度值。

使用VertexCreator中的暴露属性从JSON数组中提取坐标



5.将坐标投影到LL84中

添加一个回注变压器,并将目标坐标系设置为ll84以重新投影点。



6.检查结果

将检查器连接到VertexCreator并运行转换。检查输出可以看到我们公开的每个属性都包含在每个点中。

Output of the extracted vertexes and reprojected into LL84



数据属性:

示例1:此处使用的数据源于元天气

示例2:此处使用的数据源于不列颠哥伦比亚省政府-BC路.


以前的文章:

教程:JSON入门

JSON读卡器配置

从JSON转换为空间格式(GIS)

JSON高级阅读

JSON编写概述

JSON使用JSontemplater编写







JSON-FLATENER JSON提取 JSON转换 超声波提取机 JSON格式器 周一,2017年5月29日格林尼治标准时间18:09:20 彼得罕默索尔
JSontemplater中的if语句 https://knowledge.亚搏在线safe.com/questions/44874/if-statement-in-jsontemplater.html

是否有可能使用类似于xmltemplater的if语句:https://docs.safe.com/fme/html/fme_desktop_documentation/fme_t亚搏在线ransformers/transformers/xmltemplater.htm

jsonTemplater中的以下代码返回错误
"JSONTemplater_2(XMLTemplaterFactory): The following error occurred near line 2,查询的第50列:

jContemplater_2(xmlTemplaterFactory):表达式无效:语法错误,意外的exprsingle(缺少逗号,“”在表达式之间?)

建议和代码示例将非常受欢迎。

{    if (fme:get-attribute("IS_GRENZPUNKT") eq "1")    then        "1": {}    else       "2": {}}
杰森特普拉特 星期二,2017年5月23日18:00:05格林尼治标准时间 hire