This file is indexed.

/usr/share/doc/python-mapscript/examples/project_csv.py is in python-mapscript 7.0.7-1build2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/python
#
# Script : project_csv.py
#
# Purpose: Simple example to read a csv file and reproject point x/y data
#
# $Id$
#

import sys
import csv
import mapscript

# example invocation
# ./reproj.py ./foo.csv 2 3 EPSG:32619 EPSG:4326 

# check input parameters
if (len(sys.argv) != 6):
    print sys.argv[0] + \
        " <csvfile> <x_col> <y_col> <epsg_code_in> <epsg_code_out>"
    sys.exit(1)
else:     
    # set x and y indices
    x = int(sys.argv[2])
    y = int(sys.argv[3])

    # set input and output projections
    projObjIn  = mapscript.projectionObj("init="+sys.argv[4].lower())
    projObjOut = mapscript.projectionObj("init="+sys.argv[5].lower())

    # open file
    fCsv = open(sys.argv[1], 'r')

    # read csv 
    csvIn  = csv.reader(fCsv)
    # setup output 
    csvOut = csv.writer(sys.stdout)

    for aRow in csvIn: # each record
        # set pointObj
        point = mapscript.pointObj(float(aRow[x]), float(aRow[y]))
        # project
        point.project(projObjIn, projObjOut)

        # update with reprojected coordinates
        aRow[x] = point.x
        aRow[y] = point.y

        csvOut.writerow(aRow)
    fCsv.close()