I am trying to get url response in a uint16array buffer where I am using urllib for http communication in python3.9.
I tried np.frombuffer(url.read(),dtype=np.uint16) but its not giving correct array.
ex. array at server = {1000, 2000,3000,4000} //uint16array -> in hexadecimal {0x03E8, 0x07D0, 0x0BB8, 0x0FA0}.
send as binary octat from memory directly using array pointer. received data are correct when I am using requests library as below -
np.frombuffer(response.content,dtype=np.uint16)
Can anyone help with the syntax to be used ?
--Kuldeep
Hello I try to use api here map for findpickups, I tried to use the same example in the documentation Can you help me thank you
https://wse.ls.hereapi.com/2/findpickups.json
?mode=fastest;car;traffic:disabled
&start=waypoint0;50.115620,8.631210
&departure=2016-10-14T07:30:00+02:00
&vehicleCost=0.29
&driverCost=20
&maxDetour=60
&restTimes=disabled
&end=waypoint3;50.132540,8.649280
&destination0=waypoint1;50.122540,8.631070;pickup:LOAD2
&destination1=waypoint2;50.128920,8.629830;drop:LOAD2,value:200
&apiKey={YOUR_API_KEY}
And i get this error
{"issues":[{"message":"Cannot match 50.11562/8.63121 onto a road link with 1000.0m search radius"}],"error_id":"e4d089f1-c756-4c72-9835-717f522a0350","response_code":"400 Bad Request"}
Source : https://developer.here.com/documentation/routing-waypoints/dev_guide/topics/quick-start-pickup.html
after contact with the support : I replaced wse with fleet and remove the +02: 00
I´m not an expert in node-red and truly appreciate some help on using the node-red-node-google geocoding node.
link to Google Geolocation node-red node
I'm trying to obtain the location address via google Geolocation API from previously obtained coordinates using the node mentioned above (geocode by coordinates option). I take latitude and length via POST from an external application.
How should the latitude and longitude data be fed into the geocode node to get the correct address data? After tens of tests, I always obtain the same error: "Invalid request. Invalid 'latlng' parameter".
What I'm doing is:
Take data generated via POST http://my_public_ip:1880/geo?id={device}&time={time}&lat={lat}&lng={lng}&radius={radius}
The first node of the flow is a node-red Http In node, that implements the htp end-point, gets the info from that callback. Te info is retrieved correctly (see debug output) :
{"id":"18A834","time":"1503231980","lat":"40.xxxxxxxxxxxxxx","lng":"-3.xxxxxxxxxxxxxx","radius":"1651"}
Note: coordinates shadowed by privacy reasons.
If lng and lat values from the HTTP In node are fed into the Google Geocoding node, the message error "Invalid request. Invalid 'latlng' parameter" is received.
I fill the dialog box this way:
Latitude text box: msg.payload.lat
Longitude Text box:msg.payload.lng
I have tried several options inserting the coords function node:
convert the latitude and longitude values to float, keep only the first 7 decimals, convert again to strings ..., and always the same error is received: "Invalid request. Invalid 'latlng' parameter"
The coords function node configuration:
var coords ={};
latitude= parseFloat(msg.payload.lat).toFixed(7);
latitude1 = parseFloat(latitude);
var length = parseFloat(msg.payload.lng).toFixed(7);
var length1= parseFloat(length);
coords.payload = {lat:latitude1, lng:length1};
return coords;
The function output seems to be correct:
{"lat":40.xxxxxxx,"lng":-3.xxxxxxx}
So I expected to fill the text boxes with msg.payload.lat and msg.payload.lng should be ok. Clearly something is wrong ...
Does anybody know which is the correct way to feed longitude and latitude values to the node-red-node-google google-geocoding to get no errors?
Find below node-red used code (remember, also tested different types of variable and also tested with no function at all):
[{"id":"4dadb4d9.246a1c","type":"http in","z":"76138ea1.88752","name":"get_coords_from_post","url":"/geo","method":"get","upload":false,"swaggerDoc":"","x":300,"y":200,"wires":[["4a0b74fb.d10fcc","fb89b080.ef1cf","dac1b7ce.4cc2c8"]]},{"id":"fb89b080.ef1cf","type":"function","z":"76138ea1.88752","name":"coords","func":"var coords ={};\nlatitude= parseFloat(msg.payload.lat).toFixed(7);\nlatitude1 = parseFloat(latitude);\nvar length = parseFloat(msg.payload.lng).toFixed(7);\nvar length1= parseFloat(length);\ncoords.payload = {lat:latitude1, lng:length1};\nreturn coords; \n","outputs":1,"noerr":0,"x":510,"y":200,"wires":[["a24b08cf.22ebf8","dac1b7ce.4cc2c8"]]},{"id":"4a0b74fb.d10fcc","type":"http response","z":"76138ea1.88752","name":"","statusCode":"","headers":{},"x":484,"y":131,"wires":[]},{"id":"dac1b7ce.4cc2c8","type":"debug","z":"76138ea1.88752","name":"","active":true,"console":"false","complete":"false","x":990,"y":480,"wires":[]},{"id":"a24b08cf.22ebf8","type":"google geocoding","z":"76138ea1.88752","name":"find_address_from_coords","geocodeBy":"coordinates","address":"","lat":"msg.payload.lat","lon":"msg.payload.lng","googleAPI":"","bounds":"","language":"es","region":"","components":"","x":740,"y":200,"wires":[["dac1b7ce.4cc2c8"]]}]
You shouldn't be putting msg.payload.lat or msg.payload.lon in the config dialog. If you are passing those values in via a message object you need to leave them blank in the config dialog.
Next, as mentioned in the README.md and the info bar in Node-RED, you need to set the msg.location.lat and msg.location.lon on the incoming message to pass those value to the node.
So basically your function node should look a little bit more like this:
var coords ={};
latitude= parseFloat(msg.payload.lat).toFixed(7);
latitude1 = parseFloat(latitude);
var length = parseFloat(msg.payload.lng).toFixed(7);
var length1= parseFloat(length);
coords.location = {lat:latitude1, lon:length1};
return coords;
When searching for a specific name with a city keyword via the LinkedIn search bar in my browser, I get results that make sense (first and/or last name match, location matches). When I invoke the search_profile api, the api results do not agree with the browser results.
I'm running Python 2.7 on Ubuntu 14.04. Importing linkedin obtained via "pip install python-linkedin" resulting in python-linkedin version 4.1 and requests version 2.5.1. The authorization and application instantiation are successful.
Here's the code:
f = 'Joe' # names changed to protect the guilty
l = 'Black' # names changed to protect the guilty
p = app.search_profile(selectors=[{'people': ['first-name',
'last-name',
'id',
'location',
'num-connections']}],
params={'lastName': '{}'.format(l),
'firstName': '{}'.format(f),
'location': {'country': {'code': 'us'}, 'name': 'Greater Nashville Area'}})
print 'from search_profile for {} {}'.format(f, l)
for s in p['people']['values']:
print s['firstName'], s['lastName'], s['id'], s['numConnections'], s['location']
Any ideas?
Has anyone had an issue with the points returned by the Google Directions API? The overview_polyline doesn't seem to match the directions I've asked for.
The Directions API gives the example:
http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false
In the JSON response I see includes:
"overview_polyline" : {
"points" : "e`miGhmocNaN~DiBiNe#gEkEek#kNez#cJqq#sk#pGos#v]_}#aF_y#qm#qDe~#w]g~#gZ_Jo_#m_#yNsFgUpMov#~QebBrJq`BjTsx#w#kOqb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bk}#gcHox#_sEaPwdC~KazF{EcpCrEmeGl]auBeEi~#yiAovCwwAgsC{i#oSsbAu~Ay_AmaBk_#iKak#mh#_BmBk#wHvG#dBvA"
},
Decoding this using the Interactive Polyline Encoder Utility shows a path starting in Toronto as expected but going a different direction with an end point nowhere near Montreal.
Any ideas?
For background, I'm trying to use the polyline to generate a static map. The static map API allows passing encoded polylines.
I have had success using Mark McClure's tools:
http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/
on archive.org
Your polyline works for me when I use this tool to decode it:
http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/decode.html
on archive.org
and this to display the results:
http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/encodeForm.html
on archive.org
Encoded polylines often have issues with "\" escaping the next character.
See this example [1] (can't seem to get it to display as a link)
with each '\' changed to a single '\'
From this issue where it does display as a link.
[1] http://maps.googleapis.com/maps/api/staticmap?size=400x400&path=weight:3|color:blue|enc:cyrdIzsee#dOiBpG~j#bA%60t#mGxu#y#xl#pDdTtOnrAtRg#~J|AdHcI~Dpn#dIbwAhY%60Yde#rxBld#d%60B~LpkAzXvtB%60]rt#n_#bqAlo#vw#|NxrApYv{#%60R%60o#hHvqA|i#blE|iArhDdaAvwFz[vkCfsAl{Ei#f_#gYb}#aNtq#rAfv#nRx_Ajg#xbBnQtXnh#%60d#jz#xe#p\pt#pVrY|e#pO%60vAjwAxhAj%60Bj_AzcEvG~c#[ht#yMfz#tIhlDnv#nwIvDfmCiPlrCj#%60sCf]%60vEtVnvCfYzcAfYt_#zUlNtbArWbb#nm#fR~pAsBhqClGjlBj]zxCjo#lbD~a#%60gAzc#ft#lf#faBt]jhAluAjfCntAjlBjk#jWbZvEn^nRxTdWldArsAxWjz#zHhoBuEryCkWrbAwIn_A%60SbhBx\tbBbZpz#hy#pdBzNfm#|Cdq#fKtjAbM~Xf_#dXh}#tArv#h[|pAbb#%60_#nKf_#pYxb#bx#bh#hbAlkAr_BrNjJ|d#dE~|#jJ%60iBfWjhBgs#jr#rEbvAbhAdUfQdU%60Ete#iCrk#aWlXiN%60%60#wFl\dIzVdUz\ls#hw#|fAh|#|pAfiAbnAp|#v{A~[rhAzUhQpf#pG~r#lSdo#te#~T|\bv#jwApf#tsAvj#l~Bfh#fyA|v#nhBdmA~dBdy#vdBz%60#hlB~[~oBbo#znAxsCzbC%60%60#bs#pm#zo#nq#ly#dm#peApi#rr#lo#pXzl#jm#vh#~_A|}AboBle#lh#|_#rOzh#yQfb#oR%60k#%60#lf#nV~p#~u#nl#xpAvnAdgBpq#~\~n#bD%60%60A_A||#fKlzCre#x|BcHbo#hPff#ze#hYbsAps#pgA~p#pgAvYlt#b~#|kDzThe#%60b#%60^zeAntBv%60#%60dAxSvrBhm#hyFfTriA~DjkA~\%60fClo#jeDnS~b#zZfcA|k#j_Cv%60AznCrv#fnAjl#vt#fcAl|#pl#%60dApb#~o#~Mb\zUbUxf#zJtXHf_#g[j\sa#hg#cP%60nAsM%60_BmBpk#_Kz_#sOft#{G~a#%60C~f#cGjj#mTlc#sKl^hGdn#bv#na#pRni#vNzf#re#~qAngAr}Al{#l~#hIt_AfLpyBzvArcAvjAdkBndAtt#faA~x#jv#dkAhy#%60h#hr#jZjWpv#t\bd#xIr\rGrZc%60#d[ad#rIa%60#dT{KhQdLnKfTnOvUdUBje#qQdYrPlRnU%60HbANrGaNbu#jR|jDvAzhChEnUjJtbA}Af[l#|\lKvQMtLtFhh#fHlh#_DZ_BmO&sensor=false
Here is your line on a static map (after changing \\ to \):
http://maps.googleapis.com/maps/api/staticmap?size=400x400&path=weight:3|color:blue|enc:e%60miGhmocNaN~DiBiNe#gEkEek#kNez#cJqq#sk#pGos#v]_}#aF_y#qm#qDe~#w]g~#gZ_Jo_#m_#yNsFgUpMov#~QebBrJq%60BjTsx#w#kOqbEq_#qkCcf#}}Dej#yzCuf#o{Ba]m~EtVewAnBa%60#sNmm#}dDufGqwA_|D_z#g~CmtBkuOrBmtCyG_yCam#{%60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h#_BmBk#wHvG#dBvA&sensor=false
The Google APi have a parameter now: path=enc:
"https://maps.googleapis.com/maps/api/staticmap?
size=300x300&key=YOUR_KEY&path=enc:" + direction.routes[0].overview_polyline
Focus on offical guides