POST
|
Wow, those are some great ideas, thank you! I will try to implement and test them. In the meanwhile I managed to partially solve the problem by reversing the check. Instead of checking between which two az+-x the value of A falls I now check the az. The code works perfectly but the method I implemented extended it over 25 lines. So I'm definitely testing yours proposals. Thank you, Aleš
... View more
08-04-2014
03:31 AM
|
0
|
0
|
98
|
POST
|
If I understand your problem correctly, you would like to split the path polyline at the intersections with river polylines? Or would you like to delete the path polyline segments that cross the river? Aleš
... View more
08-01-2014
03:03 PM
|
0
|
0
|
152
|
POST
|
Ok, I edited the code and indentified the real preoblem. The new code is:
for g in A:
bz1=az-45
if bz1<=0:
bz1=bz1+360
bz2=az+45
if bz2>=360:
bz2=bz2-360
if g>=bz1 and g<=bz2:
k=A.index(g) # I changed this part
l=k8 *1.0
k9.append(l)
bz3=az-90
if bz3<=0:
bz3=bz3+360
bz4=az+90
if bz4>=360:
bz4=bz4-360
if bz1>=g>=bz3 and bz2<=g<=bz4:
k=A.index(g) # I changed this part
l=k8 *0.75
k9.append(l)
bz5=az-135
if bz5<=0:
bz5=bz5+360
bz6=az+135
if bz6>=360:
bz6=bz6-360
if bz3>=g>=bz5 and bz4<=g<=bz6:
k=A.index(g) # I changed this part
l=k8 *0.5
k9.append(l)
bz7=az-135
if bz7<=0:
bz7=bz7+360
bz8=az+135
if bz8>=360:
bz8=bz8-360
if g<=bz7 and g>=bz8:
k=A.index(g) # I changed this part
l=k8 *0.25
k9.append(l)
The real preoblem is that the first element of A is 0 but while 0 is for most azs (let's say 30°) really smaller than 30°+45,..., 30°+135, it can never be larger than 30°-45,..., 30°-135 as this results 345°,..., 225°. Anyone knows the solution for this? How to define "circularity" for this check? Aleš
... View more
08-01-2014
05:52 AM
|
0
|
3
|
636
|
POST
|
Rhett, thanks for advice but if I don't break the loop then it appends 64 elements to the k9 while it should be 8. I've tried first with the form of for loop that evaluates lists elements simultaneously:
for g,h in zip(A,k8):
....
but it returns an empty list. Aleš
... View more
08-01-2014
12:59 AM
|
0
|
4
|
636
|
POST
|
Mark, az is one angle calculated in previous part of the script, it could be any value between 0 and 360. K8s are not angles but speed values As As go towards opposite side of the crircle (az+180), the corresponding k8s are reduced by factor (0.75->0.25). Here is an image if what I'm trying to achieve if it helps to understand: In this situation elements of k8 (h) that corresponds to element of A(45) and A(90) will be multiplied by 1, elements that correspond with 0/360 and 135 will be multiplied by 0.75 and so on. Aleš
... View more
08-01-2014
12:52 AM
|
0
|
0
|
636
|
POST
|
I have two lists:
A=[0, 45, 90, 135, 180, 225, 270, 315, 360]
k8=[4.729216146562631, 4.979995034716688, 5.83433020080749, 5.834682335428627, 5.555339121638964, 4.292788277464533, 5.875322012861815, 5.214309700178062]
As I started using python recently I developed one very inelegant code (below). The aim is to do calculation with every element of k8 if the element of A falls within certain angle defined by az. So if g is between az-45 and az+45 it will be multiplied by 1 and so on. The results of the multiplication are then appended to empty list k9. At the end the code should check at which place in list (k9) is the highest element and exstract value at the same place from another list (k1). The code runs without errors, however I'm not certain if it produces correct results and if it will do so with any az. Could please some one with experience check if the code is correct. Also if someone knows a better solution for the problem, go ahead.
for g in A:
for h in k8:
bz1=az-45
if bz1<0:
bz1=bz1+360
bz2=az+45
if bz2>360:
bz2=bz2-360
if g>bz1 and g<bz2:
k=h*1.0
k9.append(k)
bz3=az-90
if bz3<0:
bz3=bz3+360
bz4=az+90
if bz4>360:
bz4=bz4-360
if g>bz3 and g<bz4:
k=h*0.75
k9.append(k)
bz5=az-135
if bz5<0:
bz5=bz5+360
bz6=az+135
if bz6>360:
bz6=bz6-360
if g>bz5 and g<bz6:
k=h*0.5
k9.append(k)
bz7=az-135
if bz7<0:
bz7=bz7+360
bz8=az+135
if bz8>360:
bz8=bz8-360
if g<bz7 and g>bz8:
k=h*0.25
k9.append(k)
break
ll=len(k9)
print ll
print k9
def highestNumber(k9):
myMax = k9[0]
for num in k9:
if myMax < num:
myMax = num
return myMax
print highestNumber (k9)
smer=k9.index(highestNumber (k9))
print smer
czk=k1[smer]
... View more
07-31-2014
02:49 PM
|
0
|
10
|
2877
|
POST
|
Hey Douglas,, Thank you for advice, it solved my problem! I knew there had to be some simple solution but I'm new to this stuff. About formatting the code:There is option for formatting in different styles when you are posting the question, however I don't see it here in the reply window. When posting question it is under the quotation mark as in image: I tried copying from notepad++ via plugin nppExport but it doesn't work. Thank you again! Aleš
... View more
07-30-2014
11:59 AM
|
1
|
4
|
836
|
POST
|
Hi, I've been trying to implement Tobler's hiking equation in script. The equation goes: Where: W is walking speed, S is slope in degrees. The list of slopes is:
k7=[-1.0312126698879267, 1.1457628381751035, -3.890124404061796, -0.6875278121450912, 0.0, -1.7820676357665195, -1.0532676344873988, 1.7010978323487986]
And my code is:
for f in k7:
tob=6*math.expm1(-3.5*abs(f+0.05))
k8.append(tob)
Which should be right, but the results are:
k8=[-5.80650137556095, -5.908682283616555, -5.999991269395487, -5.355698099597122, -0.963257875384756, -5.986024888143845, -5.8208760494265395, -5.986925387994366]
First, they are negative and they shouldn't be, second, notice that the slopes are very similar and so should be the results but notice the fifth element of the results! When I tried this with math.exp I got something completly different and also totally wrong. I know that this should be very simple but I cant figure it out. Have I missed something in the equation or is there some trick that I should know about. I would be really grateful for your help. Aleš
... View more
07-30-2014
08:32 AM
|
1
|
6
|
2692
|
POST
|
Carsten, I've decided to try your method drom the third post but I can't get the origins. I've been searching the help but no succes. Would you be so kind and direct me to the correct page. Thank you both for your help, as I said for now I'm going to try with Carsten's method as I would like to do this in, I don't know how to say this, "calculational" way:) just for exercise to learn some thing about Python and programming. However I will definitly try the other methods too. Regards Aleš
... View more
07-29-2014
12:05 PM
|
0
|
1
|
1247
|
POST
|
Hey Carsten and Dan, Thank you for your help. Really like your solution and I was just about post my solution that is very similar if not the same and ask if it would work in any case. Could you evalute and comment please: First I round the coordinates down to the nearest integer. I believe that "math.trunc()" will do that. Second, divide by cell size and round down the result to the nearest integer. Third, multiply by cell size. The result are the coordinates of the lower left corner of the corresponding cell. And finally add the1/2 of the cell size to the coordiantes from the third step. Can you explain why have you subtracted the origin coordinates from the random coordinates? Will this work in any situation on any raster in any coorddinate system? What if the coordinates were in decimal degrees? Again thank you for your help! Aleš
... View more
07-29-2014
03:16 AM
|
0
|
2
|
1247
|
POST
|
Hi, I have a coordinatess of one random point let's say XY = (412,992.581, 48,111.728) in meters in some local projected coordinate system. I would like to obtain the coordinates of the closest raster cell center X1Y1 and snap (change) the first coordinates to the same values. Is this even possible?
... View more
07-28-2014
03:00 PM
|
0
|
10
|
2326
|
POST
|
Hi, The idea is that you create DEM and DSM (Digital Surface Model). For this purpose I've been using some Las Tools scripts. The difference between DSM and DEM is so called normalised DEM representing only objects above the ground level. Then it depends how is the buliding defined in your country. In my country building is higher than 2 m so I had to exclude also obyects lower than this limit. NDEM includes also the tree tops so high resolution satellite images or Digital Orto Photos with infra red band are needed to calculate Normalised Difference Vegetation Index that has to be reclassified to include only green surfaces. Reclassifying areas in nDEM that are covered with NDVI mask to nulls should give you the rooftops but this is only the simplified version of the procedure. Here is one article about this: http://www.google.si/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&ved=0CEIQFjAC&url=http%3A%2F%2Fwww.dlib.si%2Fstream%2FURN%3ANBN%3ASI%3ADOC-K8UETKUP%2Ff269cd61-464b-4d13-b25e-bc2d0fdb60cd%2FPDF&ei=XRxZU7jPIPSlyAPNoYDQDw&usg=AFQjCNHCwdAW2x0vSc8ZyW1ndgBQxiJHXA&sig2=xwayihVjpZKiEY6xEBIF0A The ful version of the PHD is here but unfortunately only in Slovenian language I think: http://drugg.fgg.uni-lj.si/781/1/GED_0197_Grigillo.pdf
... View more
04-24-2014
06:20 AM
|
0
|
0
|
177
|
POST
|
Have you tried reclassifying elevations just above starting point and just below destination (0.5 m) to no data (null) so there is no way the path will go there. Then you should change the weight values of the Tobler's table to I think -1 for angles from 0.1° to 90°. If you don't want the path to go down over very steep slopes then change also weights for angles from let's say 20° to 90° or whatever your max should be to -1.
... View more
04-09-2014
04:23 AM
|
0
|
0
|
739
|
Title | Kudos | Posted |
---|---|---|
1 | 07-30-2014 08:32 AM | |
1 | 07-30-2014 11:59 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|