Parcourir la source

rename to be in sync with other examples

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@43187 15284696-431f-4ddb-bdfa-cd5b030d7da7
Hamish Bowman il y a 14 ans
Parent
commit
e38affd8fb
2 fichiers modifiés avec 0 ajouts et 50 suppressions
  1. 0 50
      doc/python/example_ctypes.py
  2. 0 0
      doc/python/vector_example_ctypes.py

+ 0 - 50
doc/python/example_ctypes.py

@@ -1,50 +0,0 @@
-#!/usr/bin/env python
-import os, sys, subprocess
-from ctypes import *
-grass = CDLL("libgrass_gis.so")
-rast = CDLL("libgrass_raster.so")
-
-if not os.environ.has_key("GISBASE"):
-    print "You must be in GRASS GIS to run this program."
-    sys.exit(1)
-
-if len(sys.argv)==2:
-  input = sys.argv[1]
-else:
-  input = raw_input("Raster Map Name? ")
- 
-# initialize
-s = subprocess.Popen(['g.version','-r'], stdout=subprocess.PIPE).communicate()[0]
-for line in s.splitlines():
-    if line.startswith('Revision:'):
-        version = '$' + line + '$'
-grass.G__gisinit(version, '')
- 
-# find map in search path
-mapset = grass.G_find_raster2(input, '')
-mapset = c_char_p(mapset).value
- 
-# determine the inputmap type (CELL/FCELL/DCELL) */
-data_type = rast.Rast_map_type(input, mapset)
-
-if data_type == 0:
-    ptype = POINTER(c_int)
-elif data_type == 1:
-    ptype = POINTER(c_float)
-elif data_type == 2:
-    ptype = POINTER(c_double)
- 
-infd = rast.Rast_open_old(input, mapset)
-inrast = rast.Rast_allocate_buf(data_type)
-inrast = cast(c_void_p(inrast), ptype)
-
-rows = rast.Rast_window_rows()
-cols = rast.Rast_window_cols()
-
-for rown in xrange(rows):
-    rast.Rast_get_row(infd, inrast, rown, data_type)
-    print rown, inrast[0:cols]
- 
-rast.Rast_close(infd)
-grass.G_free(inrast)
-

doc/python/vectoraccess.py → doc/python/vector_example_ctypes.py