I have to find the nearest node (the id) of a geo-spatial point in OpenStreetMap
i can use the official demo api
https://router.project-osrm.org/nearest/v1/foot/13.388860,52.517037
and i have this very nice output:
/ 20170831155106
// https://router.project-osrm.org/nearest/v1/foot/13.388860,52.517037
{
"waypoints": [
{
"hint": "DB0KgLNSo4oUAAAAIAAAAAcAAAAAAAAACgAAABAAAAAEAAAAAAAAAK7aAAAATMwAqVghAzxMzACtWCEDAQAPAN1tFXI=",
"distance": 4.085341,
"location": [
13.3888,
52.517033
],
"name": "Friedrichstraße"
}
],
"code": "Ok"
}
but the din't give me the nearest OSM node id and i can't use "?annotations=true" because i recive this message
https://router.project-osrm.org/nearest/v1/foot/13.388860,52.51703713.388860,52.517037?annotations=true
{'code': 'InvalidQuery',
'message': 'Query string malformed close to position 37'}
thanks to all for help!
This feature is currently being worked on. The PR looks good, but needs some fixes around the edges.
Try like this..
Example- http://router.project-osrm.org/nearest/v1/driving/79.887810,7.005145?number=3&bearings=90,100
Output-
{
"waypoints": [
{
"nodes": [
2264199819,
2045820592
],
"hint": "5c34iGPO-IgIAAAADgAAAAMAAAAAAAAAeOI0QY6li0FoZYRAAAAAAAgAAAAOAAAAAwAAAAAAAADxpQAAAEzMAKlYIQM8TMwArVghAwEA3wrB8JPr",
"distance": 4.096695475190991,
"name": "Friedrichstraße",
"location": [
13.3888,
52.517033
]
}
],
"code": "Ok"
}
Related
So I have a JSON file I got from Postman which is returning as an empty object. This is how I'm reading it.
import regscooter from './json_files/reginald_griffin_scooter.json'
const scoot = regscooter;
const CustomerPage = () => {...}
reginald_griffin_scooter.json
{
"success": true,
"result": {
"id": "hhhhhhhhhh",
"model": "V1 Scooter",
"name": "hhhhhhhhhh",
"status": "active",
"availabilityStatus": "not-available",
"availabilityTrackingOn": true,
"serial": "hhhhhhhhhhhh",
"createdByUser": "hhhhhhhhK",
"createdByUsername": "hhhhhhhh",
"subAssets": [
"F0lOjWBAnG"
],
"parts": [
"hhhhhhhh"
],
"assignedCustomers": [
"hhhhhhhhh"
],
"createdAt": "2019-12-03T21:47:26.218Z",
"updatedAt": "2020-06-26T22:05:54.526Z",
"customFieldsAsset": [
{
"id": "hhhhhhh",
"name": "MAC",
"value": "hhhhhhhh",
"asset": "hhhhhhhhhh",
"user": "hhhhhhhhh",
"createdAt": "2019-12-03T21:47:26.342Z",
"updatedAt": "2019-12-11T16:29:24.732Z"
},
{
"id": "hhhhhhhh",
"name": "IMEI",
"value": "hhhhhhh",
"asset": "hhhhhhh",
"user": "hhhhhhhhhh",
"createdAt": "2019-12-03T21:47:26.342Z",
"updatedAt": "2019-12-11T16:29:24.834Z"
},
{
"id": "hhhhhhhhh",
"name": "Key Number",
"value": "NA",
"asset": "hhhhhhhhh",
"user": "hhhhhhhhhhh",
"createdAt": "2019-12-03T21:47:26.342Z",
"updatedAt": "2019-12-11T16:29:24.911Z"
}
]
}
}
The error is that "const scoot" is being shown as an empty object {}. I made sure to save a ton of times everywhere. I am able to read through the imported JSON file in other variables in similar ways, so I don't know why I can't parse this one. I just want to access the JSON object inside this. Also I omitted some information with hhhhh because of confidentiality.
EDIT: The code works, but it still has a red line beneath result when I do:
const scoot = regscooter.result.id;
It would be much more effective if you will provide an example in codesandbox or so.
However at first look it might be a parser issue ( maybe you are using Webpack with missing configuration for parsing files with json extension ), meaning we need more information to provide you with a full answer ( maybe solution ? ).
Have you tried to do the next:
const scoot = require('./json_files/reginald_griffin_scooter.json');
I tried to get the example from https://learn.microsoft.com/en-us/microsoftteams/platform/get-started/get-started-dotnet to run.
I successfully built and published (on Azure) the webapp.
Then I tried
- manually editing the json file in the visual studio solution similarly to what the docs said, and then import the resulting zip in App Studio
- adding the App directly in App Studio through the manifest editor (this works, but it fails when installing/testing it)
Both give me an error without any more info "something went wrong".
Any way to actually figure out what I did wrong (if anything)?
Either way, maybe you guys can figure it out from the json file's contents:
{
"$schema": "https://statics.teams.microsoft.com/sdk/v1.0/manifest/MicrosoftTeams.schema.json",
"manifestVersion": "1.0",
"version": "1.0.0",
"id": " 1CC58D17-1E95-443C-958F-E1F14D4CA3B4",
"packageName": "com.contoso.helloworld",
"developer": {
"name": "Contoso",
"websiteUrl": "https://www.microsoft.com",
"privacyUrl": "https://www.microsoft.com/privacy",
"termsOfUseUrl": "https://www.microsoft.com/termsofuse"
},
"name": {
"short": "Hello World",
"full": "Hello World App for Microsoft Teams"
},
"description": {
"short": "Hello World App for Microsoft Teams",
"full": "This sample app provides a very simple app for Microsoft Teams. You can extend this to add more content and capabilities."
},
"icons": {
"outline": "contoso20x20.png",
"color": "contoso96x96.png"
},
"accentColor": "#60A18E",
"staticTabs": [
{
"entityId": "com.contoso.helloworld.hellotab",
"name": "Hello Tab",
"contentUrl": "https://microsoftteamssampleshelloworldweb20181022032046.azurewebsites.net/hello",
"scopes": [
"personal"
]
}
],
"configurableTabs": [
{
"configurationUrl": "https://microsoftteamssampleshelloworldweb20181022032046.azurewebsites.net/configure",
"canUpdateConfiguration": true,
"scopes": [
"team"
]
}
],
"bots": [
{
"botId": "00000000-0000-0000-0000-000000000000",
"needsChannelSelector": false,
"isNotificationOnly": false,
"scopes": [
"team",
"personal"
]
}
],
"composeExtensions": [
{
"botId": "00000000-0000-0000-0000-000000000000",
"scopes": [
"personal",
"team"
],
"commands": [
{
"id": "getRandomText",
"description": "Gets some random text and images that you can insert in messages for fun.",
"title": "Get some random text for fun",
"initialRun": true,
"parameters": [
{
"name": "cardTitle",
"description": "Card title to use",
"title": "Card title"
}
]
}
]
}
],
"permissions": [],
"validDomains": []
}
Any suggestions?
There is a whitespace in your app Id in shared manifes:
"id": " 1CC58D17-1E95-443C-958F-E1F14D4CA3B4"
Could you please remove it and try and let us know if it works? Also you can remove bots and composeExtensions section if you want.
I can't comment yet (not enough reputation points) but could you go through the instructions again?
I believe something went wrong with either the GUID, or one of the URL's. The instructions also advise to use ngrok, which is usefull for debugging.
If you can't find a clear error message, i advise you follow those instructions.
Is there a way to select only some countries of a json file?
For example, given this json that represents the NUTS 2 subdivisions of the various European countries, I would like to modify it and select only a few countries.
For example, if I wanted only Italy (and its regions) how could I do that?
I looked for sites on the Internet that did this but I didn't find anything, and processing the file manually seems a madness.
Thanks
I tried to edit the file manually but there are some problems.
The file structure is:
{
"type": "Topology",
"objects":
{
"nuts2":
{
"type": "GeometryCollection",
"bbox": [-63.15345500000001, -21.387309500000015, 55.83662850000002, 71.18531800099998],
"geometries": [
{
"type": "Polygon",
"properties":
{
"nuts_id": "ITC1",
"name": "Piemonte",
"population": 4374052
},
"id": "ITC1",
"arcs": [
[2243, 2244, 2245, -1918, -1908, 2246, -122, -164]
]
},
...
...
{
"type": "MultiPolygon",
"properties":
{
"nuts_id": "ITI4",
"name": "Lazio",
"population": 5557276
},
"id": "ITI4",
"arcs": [
[
[-2356, -2359, -2258, -2262, -2268, 2361, -2347],
[2362]
],
[
[2363]
],
[
[2364]
],
[
[2365]
],
[
[2366]
]
]
},
]
}
},
"arcs": [
[
... PROBLEM HERE
]
],
"transform":
{
"scale": [0.011900198369836986, 0.009258188568956896],
"translate": [-63.15345500000001, -21.387309500000015]
}
}
I removed the "geometries" elements that do not interest me, leaving only the Italian nuts 2.
The problem is the content inside "arcs": the elements are many and hardly recognizable..
The only thing you can do here is selecting them one by one, because the regions of Italy aren't inside a mother clause that enclouses all of them.
What you can also do if all the Italy regions are together in the Json file is iterate to the first one and exit the loop in the last region.
In ejabberd api, i can fill user,nick,room, but how can i fill the nodes? Is there any example. Thank you.
POST /api/subscribe_room
{
"user": "aaaaa",
"nick": "bbbbb",
"room": "ccccc",
"nodes": "ddddd"
}
HTTP/1.1 200 OK
[
"aaaaa",
"bbbbb"
]
My example :
{
"user":"muuser",
"nick":"ccccdd",
"room":"myRoom",
"nodes": ["urn:xmpp:mucsub:nodes:presence","urn:xmpp:mucsub:nodes:messages","urn:xmpp:mucsub:nodes:affiliations","urn:xmpp:mucsub:nodes:subject", "urn:xmpp:mucsub:nodes:config","urn:xmpp:mucsub:nodes:system"]
}
as explained here
nodes attribute is filled like so :
nodes : "urn:xmpp:mucsub:nodes:messages,urn:xmpp:mucsub:nodes:affiliations"
I am new to Apigee,I had tried a query to extract the value from the json data child and i need to get the parent element from the json data.
JSON is Here:
{ "Booksstall": [
{ "serialId": "10123456",
"Name": "magic"
"books": [
{ "Order": 3,
"Name": "Supermax"
}
],
"NormalserialIds": [
{"serialId": "1234556",
"Status": "InStock",
"books": [
{"type": "400001623",
"Code": "PATR"
}
]
},
{"serialId": "789101",
"Status": "OutoffStock",
"books": [
{"type": "400001623",
"Code": "NFES"
}
]
}
]
}
]
}
I tried this query in online json validator ,but if I tried same in the Apigee extract variable policy by doing substitution Its not returning me any values.
$.Booksstall[?(#.NormalserialIds[0].serialId=="1234556")].serialId
The above query result is: 10123456.
Please suggest how can I try this.
You can also use Javascript Policy to extract same. It should be simple and straight forward with Javascript Policy.
Cheers,
Anil Sagar