当前位置: 首页 > 面试题库 >

Maximo / GIS空间查询

公冶浩慨
2023-03-14
问题内容

我在Maximo 7.6.1.1中有一个工作订单:

  • WO 在“服务地址”选项卡中具有LatitudeY并进行LongitudeX协调。
  • WO具有一个自定义zone字段。

在单独的GIS数据库中有一个要素类(多边形)。

我想进行 空间查询, 以从 WO相交多边形记录中 返回一个属性,并使用它填充zone到WO中。

我怎样才能做到这一点?


问题答案:

Maximo
76脚本功能

(pdf)的“库脚本”部分中修改代码

#What the script does:
#     1. Takes the X&Y coordinates of a work order in Maximo
#     2. Generates a URL from the coordinates
#     3. Executes the URL via a separate script/library (LIB_HTTPCLIENT)
#     4. Performs a spatial query in an ESRI REST feature service (a separate GIS system)
#     5. Returns JSON text to Maximo with the attributes of the zone that the work 
#        order intersected
#     6. Parses the zone number from the JSON text
#     7. Inserts the zone number into the work order record

from psdi.mbo import MboConstants
from java.util import HashMap
from com.ibm.json.java import JSONObject

field_to_update = "ZONE"
gis_field_name = "ROADS_ZONE"

def get_coords():
    """
    Get the y and x coordinates(UTM projection) from the WOSERVICEADDRESS table
    via the SERVICEADDRESS system relationship.
    The datatype of the LatitdeY and LongitudeX fields is decimal.
    """
    laty  = mbo.getDouble("SERVICEADDRESS.LatitudeY")
    longx = mbo.getDouble("SERVICEADDRESS.LongitudeX")

    #Test values
    #laty  = 4444444.7001941890
    #longx = 666666.0312127020

    return laty, longx


def is_latlong_valid(laty, longx):
    #Verify if the numbers are legitimate UTM coordinates
    return (4000000 <= laty <= 5000000 and
            600000 <= longx <= 700000)


def make_url(laty, longx, gis_field_name):
    """
    Assembles the URL (including the longx and the laty).
    Note: The coordinates are flipped in the url.
    """

    url = (
        "http://hostname.port"
        "/arcgis/rest/services/Example"
        "/Zones/MapServer/15/query?"
        "geometry={0}%2C{1}&"
        "geometryType=esriGeometryPoint&"
        "spatialRel=esriSpatialRelIntersects&"
        "outFields={2}&"
        "returnGeometry=false&"
        "f=pjson"
    ).format(longx, laty, gis_field_name)

    return url


def fetch_zone(url):
    # Get the JSON text from the feature service (the JSON text contains the zone value).
    ctx = HashMap()
    ctx.put("url", url)
    service.invokeScript("LIBHTTPCLIENT", ctx)
    json_text = str(ctx.get("response"))

    # Parse the zone value from the JSON text
    obj = JSONObject.parse(json_text)
    parsed_val = obj.get("features")[0].get("attributes").get(gis_field_name)

    return parsed_val


try:
    laty, longx = get_coords()
    if not is_latlong_valid(laty, longx):
        service.log('Invalid coordinates')
    else:
        url = make_url(laty, longx, gis_field_name)
        zone = fetch_zone(url)

        #Insert the zone value into the zone field in the work order
        mbo.setValue(field_to_update, zone, MboConstants.NOACCESSCHECK)
        service.log(zone)
except:
    #If the script fails, then set the field value to null.
    mbo.setValue(field_to_update, None, MboConstants.NOACCESSCHECK)
    service.log("An exception occurred")

LIBHTTPCLIENT :(可重用的Jython
库脚本)

from psdi.iface.router import HTTPHandler
from java.util import HashMap
from java.lang import String

handler = HTTPHandler()
map = HashMap()
map.put("URL", url)
map.put("HTTPMETHOD", "GET")
responseBytes = handler.invoke(map, None)
response = String(responseBytes, "utf-8")


 类似资料:
  • 我正在创建一个模型,在该模型中,我在GIS空间中拥有大量代理。我也有位于设定GIS点的区域。我想为初始模型创建一个自定义分布,以便群体中的个体的原始值是其中一个区域,这是代理开始的位置。我已经创建了一个选项列表,并为其分配了分发值。但是,它无法从原点(键入表单选项列表)转换为区域。人口的来源类型region的值是自定义分布,但它会引发 自定义分布类型不匹配:无法从Origin转换为Area。 我如

  • QGIS 是一个用户界面友好的桌面地理信息系统,可运行在 Windows、Mac、Linux、BSD、安卓等平台之上。 QGIS 是基于 Qt 和 GDAL 等开源软件,使用 C++ 开发的一个用户界面友好、跨平台的开源版桌面地理信息系统。项目开始于 2002 年 5 月,目前的开发非常活跃,当前(2018年)的最新稳定版本是 QGIS 2.18 ,已发布 3.0 开发版本。QGIS 源码采用 G

  • 目前的很多的项目中都用到了GIS 软件,然而在开源的GIS软件中有SharpMap在工程应用中开始被人发觉。相比一些GIS软件它拥有的优势有: 1、占用资源较少,响应比较快。在对于项目中如果只需要简单的地图功能的话,是一个比 较好的选择 。 2、它是基于.NET 2.0环境下开发的,对于.NET环境支持较好。 3、使用简单,只要在.NET项目中引用响应的dll文件即可,没有复杂的安装步骤。 目前支

  • 一款Linux下的地理信息系统

  • 平面算法 特性 坐标转换算法 反距离加权插值 利用构建规则网格(GRID) 计算体积 纵断面计算 根据K-means 分割多边形 最小外接矩形 凹点切割 最大内接圆 最小外接圆

  • 我是Neo4J的新手,我正在尝试为基于时空的高可用性查询建立一个概念证明。 我有一个设置,有2个独立的Neo4J企业服务器和一个运行嵌入式HA Neo4J服务器的Java应用程序。 一切都很容易设置,基本查询也很容易设置和高效。另外,按照预期执行从Neo4J SpatialRepository派生的查询。 我正在努力理解的是如何使用SDN与任何其他where子句组合进行空间查询。作为一个微不足道的