POST
|
Thanks guys for the reply. Darren's answer is closer to what I want to achieve. Cheers, Sui
... View more
03-19-2015
11:30 PM
|
0
|
0
|
1176
|
POST
|
Hello everyone, I'm trying to write a python script to loop through geostatistical layers in a folder (a snapshot is attached below), then loop through another folder which contains a point shapefile (a snapshot attached as well), find the match between the two based on names (e.g., 1a1a0.lyr vs 1a1a0 in the 'dateid' field), and last, use a 'GA layer to point' to the matching points. So how can I accomplish this task? More specifically, how do I create a nested loop to match the layers with the points of one shapefile? Many thanks, Sui These are a sample of layers This is the attribute table of points
... View more
03-13-2015
09:25 PM
|
0
|
8
|
5025
|
POST
|
Jayanta, Monica and Steve, thanks a lot for the helpful reply. But Steve's answer is the closest one. Cheers, Sui
... View more
03-13-2015
08:02 PM
|
0
|
0
|
649
|
POST
|
Hi Jayanta, Thank you for the reply. And sorry for not being thorough. The reason I want to keep geostatistical layer is that I want to use another tool, that is GA layer to points later to spatially join the kriging results to another point features. Not sure whether I can do that with raster. Please inform me if there is a way to achieve what I want? Best, Sui
... View more
03-13-2015
04:31 AM
|
0
|
1
|
649
|
POST
|
hi everyone, I created a simple model builder that iterates through several point shapefiles and conducts kriging (empirical bayesian kriging) to each set of the points. However, after conducting the model, I cannot find the resulting geostatistical layer in my previous designated folder (or a gdb). So where do I actually find these results? many thanks, Sui
... View more
03-13-2015
01:20 AM
|
0
|
6
|
3954
|
POST
|
Hi Larry, Really sorry for the belated reply. Had to put kriging aside due to overloaded work. I now have the chance to do kriging on sparse weather data. Here's a sample of the kriging surface using 14 data points of relative humidity. And here's some statistical modelling results: I used ordinary krigining without changing other settings in the ArcGIS. While not ideal, the results seem to be not so bad either--the standardised root-mean-square is moderately larger than 1, the average standard error is also moderately different from root-mean-square. What do you think about the results and any suggestions for improvement? Many thanks, Sui
... View more
03-10-2015
10:53 PM
|
0
|
0
|
1103
|
POST
|
Hi everyone: I wrote the following code to transform the data in a csv file and write to another csv file: import csv import re fp = r'C:\data\input.csv' fpw = r'C:\data\output.csv' with open(fp, 'rb') as input, open(fpw, 'wb') as output: for row in csv.reader(input😞 try: stop = row[11] # find a particular field extr = re.search(r"\[([A-Za-z0-9_]+)\]", stop) # extract value enclosed by brackets in that field stop_id = str(extr.group(1)) row[11] = stop_id # replace the original field with the extracted value repl_row = ','.join(row) + '\n' output.write(repl_row) # write the tweaked row to another csv file except csv.Error: pass The code worked half way through the file and stopped due to an error raised, that said 'for row in csv.reader, line contains NULL byte'. I want to skip this error and proceed. Despite the except statement, it still stopped. Does anyone know how to solve this issue? Much appreciate, Sui
... View more
01-08-2015
10:05 PM
|
0
|
1
|
33686
|
POST
|
Hi Larry, Many thanks for the detailed reply. I will have a go and get back to you concerning the results. Regards, Sui
... View more
01-06-2015
11:05 PM
|
0
|
0
|
1103
|
POST
|
Hi Larry, Many thanks for your swift reply. Yet due to my own omissions, there are some unclear points. First, I understand that certain conditions should be met for the data before applying the kriging method, e.g., normal distribution, stationary data. Considering the obvious small sample, I kinda expected there will be some skewed distribution, questionable stationarity, etc, existing in the data. In that case, if I just proceed with kriging, chances are that the results will be questionable as well (as found in another similar post arcgis 10.1 - Minimum number of samples for kriging interpolation - Geographic Information Systems Stack Exchange). While it has been suggested certain preliminary tests of the data should be carried out, it seems unclear what these tests entail. Hence what pre-process (if any) should be carried out before kriging with sparse data? Second, could you please expand a bit more on different methods you mentioned, e.g., what methods exactly can be used in this situation? Sorry for this rudimentary questions, I'm still very much in a learning process. Sui
... View more
01-05-2015
10:50 PM
|
0
|
2
|
1103
|
POST
|
Hello Everyone, I'm trying to use spatial-based weather data (temperature, rainfall, wind, etc) to estimate and create a weather surface across Brisbane, Australia. I only have data of 13 locations in total as shown in the attached figure across Queensland, the state for which Brisbane is the capital city. It seems that kriging is a possible and proper solution to fulfill my goal. However, some suggested that at least 30 distinct locations of data were ideal to do kriging. I currently don't have other datasets and doubt there will be. So my question is how can I apply the kriging method to this rather sparse weather data to generate a reasonably acceptable results of weather surface? Do I add artificial points such as copying the same data point to nearby locations? Any suggestions are welcome. And thank you in advance! Best regards, Sui Tao
... View more
01-05-2015
08:57 PM
|
0
|
8
|
6448
|
POST
|
Hi Melinda, I tested the method on one route, and the resulting sequence of stops (they are not even on the route/polyline but only within a certain distance to the route) based on the calculated online distance is correct, which is amazing! I did not define the start nor end point of the route, but it seems this method automatically found the start point. I'm still curious about the calculation method. But it seems working out. Will test them on all the routes and stops to reassure. Many thanks! Sui
... View more
03-13-2014
12:15 AM
|
0
|
0
|
388
|
POST
|
Sorry, a second issue: I'm still confused about how the calculation is defined of measureOnLine. In arcGIS resource it says 'A point (PointGeometry or Point) that is used to measure from the start point of the polyline.' So how does it identify start point? Does it automatically find the first point when the polyline is created?
... View more
03-12-2014
09:55 PM
|
0
|
0
|
388
|
POST
|
Another issue: for one certain route, if the stops (points) are not actually on this route (polyline). Is it still OK to use measureOnLine to calculate distance?
... View more
03-12-2014
07:08 PM
|
0
|
0
|
388
|
POST
|
Glad you figured it out. Yes, the SearchCursor returns items in a tuple. You could have chosen to return more than one field (in addition to SHAPE@), and it would have returned something like (SHAPE@, Field, Field), so it makes sense that you have to use a [0] to get the first item in the tuple (even if there is only one item in it). The distance is, I believe, the distance along the route in the units of the coordinate system used by the route. If it's in a geographic coordinate system, you should probably project it into something appropriate for the area you're studying. Do your stops have a route ID associated with them? If so, you can use a loop to loop through the routes. For each route, you can use MakeFeatureLayer on the stops to select only the stops associated with the route ID, and then do the SearchCursor on the feature layer and loop through those stops to calculate the distance along the line. Something like this (which I didn't test, so it might not be perfect): cursorRoute = arcpy.da.SearchCursor(fcRoute,['SHAPE@', 'RouteID'])
for route in cursorRoute:
RouteID = route[1]
routeGeom = route[0]
where = '"RouteID" = %s' % str(RouteID)
arcpy.management.MakeFeatureLayer(fcStop, "Stops", where)
cursorStop = arcpy.da.SearchCursor(fcStop,['STOP_ID','SHAPE@'])
for stop in cursorStop:
stopGeom = stopGeom[1] # Looks like the geometry is the second item in your tuple here
dist_along_route = routeGeom.measureOnLine(stopGeom,FALSE) Thanks Melinda. Looks much closer to what I want. Trying this right away.
... View more
03-12-2014
03:18 PM
|
0
|
0
|
388
|
POST
|
Hi Melinda, Sorry for this heavy replying. I did more change to the script and the measureOnLine finally works. Here's the script: >>> import arcpy # import stop feature class and create geometry objects >>> fcStop = 'C:/shapefile/bus_stops.shp' >>> cursorStop = arcpy.da.SearchCursor(fcStop,['STOP_ID','SHAPE@']) >>> stopGeom = cursorStop.next() >>> stopGeom = stopGeom[0] # import route feature class and create geometry objects >>> fcRoute = 'C:/shapefile/routes.shp' >>> cursorRoute = arcpy.da.SearchCursor(fcRoute,['SHAPE@']) >>> routeGeom = cursorRoute.next() >>> routeGeom = routeGeom[0] #measure distance on route >>> dist_along_route = routeGeom.measureOnLine(stopGeom,FALSE) #print results >>> print dist_along_route The above script generates a value of 26983.41708113748. I think it calculates the distance of the first stop to the first route. I checked the stop and the route, turned out the stop is not on the route. So two more questions: 1) How to interpret the meaning of this 'distance'? Is it euclidean distance? 2) For each route, how to calculate the distances of stops that only falls on this route? Should I generate separate point shpfiles for each route? Again, sorry for all the troubles, and many thanks. Sui
... View more
03-11-2014
11:33 PM
|
0
|
0
|
388
|
Title | Kudos | Posted |
---|---|---|
1 | 03-11-2014 07:54 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|