Display result GeoQuerySet - postgis

I'm trying to query my PostGis database thanks to geoDjango but I have an error where I found no solution on the internet.
close_loc=PlanetOsmPoint.objects.get(way__distance_lte=(lePoint, D(**distance_from_point)))
Whatever I try on the result (close_loc) with a print, I have this error :
django.db.utils.DatabaseError: Only lon/lat coordinate systems are supported in geography.
I tried to convert it to a correct format thanks to transform(SRID) but nothing was solved, still the same problem.
Here's some informations :
Transformation :
sr1=SpatialReference('54004')
sr2=SpatialReference('NAD83')
ct=CoordTransform(sr1, sr2)
What I'm doing after getting the close_loc :
close_loc.transform(ct)
print close_loc[0]
close_loc type is GeoQuerySet.
How can I exploit this result ?

The transform() function expects an integer, not a string. The correct syntax is:
close_loc.transform( new_srid_number )
In your case, something like this:
close_loc.transform(54004)
Hope it'll work !

Related

How can I convert my phone country code to iso2 in React Native

For example, I have +92 phone code for Pakistan and I want to convert it to iso2( e.g Pakistan's iso2 is 'PK'). So, is there any library to do this? I have tried 'country-code-lookup' but it is giving wrong result.
import * as lookup from 'country-code-lookup';
lookup.byIso(parseInt('+92'))
It should return an object with iso2 'PK', but it is giving me a wrong result. I have also tried lookup.byIso(parseInt('92'), without + at parameter, but still getting wrong result! Your help would be appreciable! Thanks
Link of country-code-lookup : https://github.com/richorama/country-code-lookup
Try to use React Native Phone Number Input package:
https://reactnativecode.com/react-native-phone-number-input/

one-hot encoding issue

I have the following code which i am trying to achieve one hot encoding.
k=tf.Variable(tf.zeros((10,1)))
hprev=tf.Variable(tf.zeros((10,1)))
x=tf.placeholder(tf.int32,shape=None,name="x")
y_op =tf.assign(k, k[x,0].assign(1))
M_c=tf.concat((hprev,y_op),axis=0)
init=tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
print(sess.run(y_op,feed_dict={x:1}))
print(M_c.eval())
I get the error:You must feed a value for placeholder tensor 'x_64' with dtype int32. Yet I have passed 1 as the value, which in my understanding is an integer. What I am doing wrong ?. I am still a beginner please.

Error in sort.list(y) : invalid input 'Eldon Imàge® Series Desk Accessories, Clear' in 'utf8towcs'

I'm still a newbie in R and I have ran logistic regression model with the below code and the error in the title appeared.Please help
code
logit_model <- glm(train_data$Returns ~ .,
data=train_data,
family =binomial (link="logit"))
No worries fam,the error was that one of the columns had a long name in it.Logistic regression could not execute,maybe it was length issue
The error is related to encoding, check this word "Imàge®", it has Unicode characters.

Can't use paramaters in HP Loadrunner 11

I have the following code:
lr_output_message( "We are on iteration #%s", lr_eval_string( "{iteration}" ) );
Return log message:
We are on iteration #{iteration}
Did anyone have the same poblem?
A few hours ago, it was works fine.
The only time you'll see an output like that is if LoadRunner can't find a parameter with that precise name.
Usually this is because you've done something wrong; a typo, etc.
Did you define "iteration" EXACTLY like you are using it? Or did you do something like use a capital 'I' (Iteration), or spell it differently, etc?
Please try this:
lr_output_message( "We are on iteration # %d", atoi(lr_eval_string("{iterationnumber}")));

Error about sending an image into bytea column in postgresql db with libpq library

I'm coding in C and using Libpq library of Postgresql and I would like to store a PNG image into the database in "bytea" type. I have been searching on the net for hours and couldn't find a good example to handle this work, so wanted to write here and ask for your help.
I have 12 params to bind and one of them is PNG image. The rest are char*, and no problem with them.
Below is what I have tried so far. (I'm writing the necessary part of code):
PGresult *res;
PGconn *conn;
const char *paramValues[12];
int paramLengths[12];
int paramFormats[12];
const char* imageFrame=frameImageArray.data();// frameImageArray.data is const char*.
int imageSize=frameImageArray.size();
paramFormats[11]=1;
paramLengths[11]=imageSize;
paramValues[11]= imageFrame;
// insertplate is a function on db
res = PQexecParams(conn,
"SELECT insertplate($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12)",
12, // param number
NULL, // oid param type
paramValues, // param values
paramLengths, // param lengths
paramFormats, // params format, 1 for binary
1); //1 for binary result
It is compiled with no problem but when it comes to store the image to db on runtime, the classical runtime error occures :
"Unhandled exception at 0x6d3dc220 in ..._debug.exe: 0xC0000005: Access violation reading location 0x000000007f91e508."
Seems something about memory handling.
Whatever I tried, I couldn't make it run and I'm not able to see my error. Do I have to use Oids for sending binary data to db with PQexecParams? Or something else I'm missing ? I really appreciate if someone help me with this.
Thanks in advance.
Edit: I just realised that if I use Insert statement, it works well, but this function doesn't. Normally it works. Weird.
I finally find the error.
//paramFormats[0]=0;
//paramFormats[1]=0;
//paramFormats[2]=0;
//paramFormats[3]=0;
//paramFormats[4]=0;
//paramFormats[5]=0;
//paramFormats[6]=0;
//paramFormats[7]=0;
//paramFormats[8]=0;
//paramFormats[9]=0;
//paramFormats[10]=0;
//paramFormats[11]=1;
It is possible to leave the "parameter format" as NULL, but I wanted to set only "paramFormats[11]" as seen above. I have set the others to 0 as well and it worked. I didn't expect something like this.

Resources