How to show an entity from in the Wirecloud MapViewer widget

只愿长相守 提交于 2019-11-26 22:08:48

问题


Well I'm trying to show the following entity:

{
  "contextResponses" : [
    {
      "contextElement" : {
        "type" : "City",
        "isPattern" : "false",
        "id" : "Miraflores",
        "attributes" : [
          {
            "name" : "position",
            "type" : "coords",
            "value" : "-12.119816, -77.028916",
            "metadatas" : [
              {
                "name" : "location",
                "type" : "string",
                "value" : "WSG84"
              }
            ]
          }
        ]
      },
      "statusCode" : {
        "code" : "200",
        "reasonPhrase" : "OK"
      }
    }
  ]
}

Wiring NGSI Source and NGSI Entity to Poi operatiors with MapViewer widget (Insert/Update PoI), with the following settings:

NGSI Source

  • NGSI server URL: mydirection:1026
  • NGSI proxy URL: http://mashup.lab.fi-ware.org:3000/
  • NGSI entities: City
  • NGSI Attributes: position

NGSI Entity to Poi

  • Coordinates attribute: position

But nothing shows up in the map! Can somebody help me figure out what the problem is?


回答1:


Seems your configuration is correct (I'm assuming mydirection:1026 is a full URL, i.e. includes the protocol), but probably your network is filtering port 3000. Try to use http://ngsiproxy.lab.fi-ware.org as NGSI proxy instead of http://mashup.lab.fi-ware.org:3000/.

Indeed, I recommend you to enable https notifications in your context broker instance and use https://ngsiproxy.lab.fi-ware.org instead, especially if you are creating your WireCloud dashboard in an https web page (e.g. https://mashup.lab.fi-ware.org) as using this NGSI proxy will solve some mixed content problems, see:

  • Chrome: https://support.google.com/chrome/answer/1342714?hl=en
  • Firefox: https://blog.mozilla.org/tanvi/2013/04/10/mixed-content-blocking-enabled-in-firefox-23/

Update: FIWARE has move from fi-ware.org to fiware.org. The recommended NGSI proxy server is now ngsiproxy.lab.fiware.org (ngsiproxy.lab.fi-ware.org still works).




回答2:


Three simple steps to start MapViewer on Fiware:

  1. Update the Orion ContextBroker in your system

  2. You should check if the daemons rush and rdis are installed and running in your system

  3. You should create a correct boot sequence in the init.d: redis, rush and contextBroker

After these steps, you can build your viewing interface in Wirecloud using MapViewer, NGSI source and NGSI entity to POI.

You must use structured JSON messages correctly as in the following example:

{ "contextElements": 
 [
    {
        "type": "iotdevice","isPattern": "false","id": "edison1", "attributes": 
        [
            {
                "name": "temperature",
                "type": "string",
                "value": "10"
            },
            {
            "name" : "position",
            "type" : "coords",
            "value" : "-20, 35",
            "metadatas" : [
              {
                "name" : "location",
                "type" : "string",
                "value" : "WSG84"
              }
         ]
         }
]
}
],

   "updateAction": "APPEND"
}


来源:https://stackoverflow.com/questions/27129318/how-to-show-an-entity-from-in-the-wirecloud-mapviewer-widget

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!