Code Monkey home page Code Monkey logo

Comments (14)

hylkevds avatar hylkevds commented on June 23, 2024

A Thing can only have 1 real-world location. Therefore, if you add a new Location to a Thing, the old location is automatically removed.
A Thing can have multiple Location entities, but they have to be different encodings of the same real-world location.
To link these multiple Location entities to the Thing, you have to link them all in the same request.

from frost-server.

smilehappy126 avatar smilehappy126 commented on June 23, 2024

Hi,
Thanks for replying. I've tried create new Things through Postman and link to two existed location as below.
image

However, I'd like to create Thing and also create two new Locations link it at the same times. I'd try to POST like this:
image

But the "test2" Location just automatically overwrite "test1" Location.
Am I missing something?

Thanks for any advices!

from frost-server.

hylkevds avatar hylkevds commented on June 23, 2024

Your test2 JSON is not valid.
A JSON object is a set of key-value pairs, and each key is only allowed to exist once. Your test2 JSON has the key "Locations" twice, and thus only one of the two is ever available.

from frost-server.

smilehappy126 avatar smilehappy126 commented on June 23, 2024

Hi,
Successfully create. However, it seems to be considered as one Location with two kinds of descriptions.
How can I create two different Locations Object just in one request.
image

Thanks for answering.

from frost-server.

hylkevds avatar hylkevds commented on June 23, 2024

That JSON looks fine to me. Locations is an array, with two objects in it.
If you format your JSON properly it'll be easier to recognise.

from frost-server.

smilehappy126 avatar smilehappy126 commented on June 23, 2024

Thanks a lot. The problem is fixed.

from frost-server.

smilehappy126 avatar smilehappy126 commented on June 23, 2024

Hi,
Now with the Multiple Location, it seems that Observation can't automatically link Location as it's FeatureOfInterest.
How can I let the server automatically use the first Location object in Location Array as the Observation's FeatureOfInterest?

Thanks for answering.

from frost-server.

hylkevds avatar hylkevds commented on June 23, 2024

Hmm, it seems it fetches the first Location it finds in the database. If that happens to be one of the non-geoJSON Locations, it'll fail. Which error message do you get?

from frost-server.

smilehappy126 avatar smilehappy126 commented on June 23, 2024

This is how the Locations Table looks like in my PostgreSQL:
image
And the error code was "HTTP code 500", using Eclipse :
image

from frost-server.

hylkevds avatar hylkevds commented on June 23, 2024

Ok, that's the client side error, do you happen to have the server-side exception from the server logs?

from frost-server.

hylkevds avatar hylkevds commented on June 23, 2024

It should work in the master branch now.

from frost-server.

smilehappy126 avatar smilehappy126 commented on June 23, 2024

Thanks for fixed it, the problem of FeatureOfInterest was solved.
However, there's something bad happened.

image
As the pic shows, the Location which was selected to be Observation's FeatureOfInterest disappeared in the /v1.0/Location, but it still remain in postgre's Location Table.
image

from frost-server.

hylkevds avatar hylkevds commented on June 23, 2024

Can you add an orderby to that query, to make sure it isn't somewhere else in the result set? Without an explicit orderby you never know which oder PostgreSQL gives you the results.

from frost-server.

smilehappy126 avatar smilehappy126 commented on June 23, 2024

Oh, I found it when I orderby "@iot.id". Thanks a lot !!

from frost-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.