span8
span4
我正在制作一个标准化的excel表格,它可以很容易地将我输入的数据/特性转换成我自己想要的数据/特性。根据翻译表中的输出样式行,将代码转换为文本、日期或数字。
我有以下excel表格风格,我使用的翻译:
category_old | value_old | category_new | sort_of_data | value_new | note_about这个应该怎么WORL |
日期 | date_of_construction | 日期 | 日期只复制 | ||
road_tpe | 沥青 | road_type | existing_list | 01 | 该名单在我的数据库已经知道 |
road_tpe | 具体 | road_type | existing_list | 02 | 该名单在我的数据库已经知道 |
road_te | 分子 | road_type | existing_list | 03 | 该名单在我的数据库已经知道 |
DMG | 一种 | damage_asphalt | 分裂 | 01 | 如果道路沥青==填写相同的值 |
DMG | 乙 | damage_asphalt | 分裂 | 02 | 如果道路沥青==填写相同的值 |
DMG | 一种 | damage_concrete | 分裂 | 01 | 如果道路==具体填写相同的值 |
名称 | 街道名称 | new_list | 做一个表,所有uniqeu街道和尽数1至x和添加匹配的数字表 | ||
特性属性表如下:
ID | 日期 | road_tpe | DMG | 名称 |
1 | 2016年11月11日 | 分子 | 一条街 | |
2 | 2016年11月11日 | 沥青 | 乙 | 一条街 |
3 | 2016年11月11日 | 沥青 | 一种 | 乙街道 |
4 | 2016年11月11日 | 具体 | 一种 | ç街 |
结果应该是这样的
ID | date_of_construction | road_type | damage_asphalt | damage_concrete | 街道名称 |
1 | 2016年11月11日 | 03 | 空值 | 空值 | 01 |
2 | 2016年11月11日 | 01 | 02 | 空值 | 01 |
3 | 2016年11月11日 | 01 | 01 | 空值 | 02 |
4 | 2016年11月11日 | 02 | 空值 | 01 | 03 |
我目前编写的SQL代码将数据加入到InlineQuerier中,并在此之后手动添加所有转换,但这需要大量的巨型表工作。我试着让它完全自动化,但却被卡住了。输入应该是命名所有标准的数据集的自定义翻译表,输出应该总是shp,在这种情况下,还应该是街道名称(ID、street_name[in text]和代码)的额外翻译表。有没有可能使InlineQuerier中的信息适应于列表(比如UniqueValueLogger) ?
谢谢你的回答,我现在正在调查这个阴谋家。这看起来是一个不错的选择,但看起来您仍然需要按名称命名过滤器中的属性。我想知道我是否可以让它变得更动态,就像这样,基于在excel中已经给出的值:
如果sort_of_date ==日期:字符串(category_new [1])=日期##含义:date_of_construction接管日期值road_tpe这应该是这样的:如果sort_of_date == existing_list:***使基于唯一值的列表 the category_old and Value_old for i in (length list) if value_old of road_tpe == value_old_list[i] value_old = value_new if sort_of_date == split: split that takes road_tpe into account (road_tpe should be stored in a extra attributes split_category and split_value) after that its the same as above if sort_of_date == new_list: makes a list of all unique values and makes a new table of it that will be exported (name, code, order) the code is just a count transformer order is the list in alphabetical order after this all street names should be replaced by the code.
嗨@ jdh009,我认为如果你添加一个小的预处理,InlineQuerier就能成功。如。
然后,使用此设置由InlineQuerier执行一条SQL语句。
选择一个。*,b。value_new as road_type, case when a.road_tpe = 'asphalt' then c.value_new else null end as damage_asphalt, case when a.road_tpe = 'concrete' then c.value_new else null end as damage_concrete, d.street_name as street_name from Feature as a inner join (select value_old, value_new from Style where category_old = 'road_tpe') as b on b.value_old = a.road_tpe left outer join (select value_old, value_new, category_new from Style where category_old = 'dmg') as c on c.value_old = a.dmg and c.category_new like '%'||a.road_tpe inner join Street as d on d.name = a.name order by a.ID
这听起来像的SchemaMapper也许能解决。考虑到您已经在Excel中有了自己的映射表,设置起来可能会相对容易一些。我链接到的那个页面有一些教程和用例。
希望这可以帮助。
©2019安全亚搏在线软件公司法律