Skip to content

Commit 33f6351

Browse files
authored
Merge pull request #52 from geoscript/GEOSCRIPT-PY-GT22
Upgrade to GeoTools 22
2 parents 763f91b + 6ce418b commit 33f6351

File tree

18 files changed

+408
-396
lines changed

18 files changed

+408
-396
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ env
1414
tests/dbexts.ini
1515
scripts
1616
site
17+
.idea/
18+
*.iml
19+
build/
20+
*.jython_cache

bin/geoscript

Lines changed: 0 additions & 16 deletions
This file was deleted.

bin/geoscript-py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
JYTHON=""
4+
if [ "$JYTHON_HOME_DIR" != "" ] && [ -e $JYTHON_HOME_DIR/jython ]; then
5+
JYTHON=$JYTHON_HOME/bin/jython
6+
else
7+
which jython > /dev/null
8+
if [ "$?" == "1" ]; then
9+
echo "JYTHON_HOME_DIR not defined and jython not on the current PATH"
10+
exit -1
11+
fi
12+
JYTHON=`which jython`
13+
fi
14+
15+
export CLASSPATH=`geoscript-py-classpath`
16+
$JYTHON

bin/geoscript-py.bat

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
@ECHO OFF
2+
3+
REM SETLOCAL ENABLEDELAYEDEXPANSION
4+
5+
REM ensure JYTHON_HOME_DIR set
6+
IF NOT DEFINED JYTHON_HOME_DIR (
7+
GOTO NO_JYTHON_HOME
8+
)
9+
10+
REM ensure jython.bat can be found
11+
SET JYTHON_EXE="%JYTHON_HOME_DIR%\jython.bat"
12+
IF NOT EXIST %JYTHON_EXE% (
13+
GOTO NO_JYTHON
14+
)
15+
16+
REM run geoscript-classpath script
17+
FOR /f "tokens=*" %%X IN ('%JYTHON_EXE% %~dp0geoscript-py-classpath') DO (
18+
SET CLASSPATH=%%X
19+
)
20+
21+
%JYTHON_EXE%
22+
SET JYTHON_EXE=
23+
24+
:NO_JYTHON_HOME
25+
ECHO Error, JYTHON_HOME_DIR is unset. Please set JYTHON_HOME_DIR to root of Jython installation.
26+
GOTO DONE
27+
28+
:NO_JYTHON
29+
ECHO Error, JYTHON_HOME_DIR was set but could not find 'jython' exe.
30+
GOTO DONE
31+
32+
:DONE

bin/geoscript.bat

Lines changed: 0 additions & 32 deletions
This file was deleted.

doc/devel.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@ This section describes how to set up a GeoScript development environment.
88
Install Jython
99
--------------
1010

11-
Jython version 2.5.1 or greater is required for GeoScript.
11+
Jython version 2.7.2 or greater is required for GeoScript.
1212

1313
* Install `Jython <http://www.jython.org/downloads.html>`_
1414

15-
For the remainder of the document the Jython installation root will be referred to as ``JYTHON_HOME``.
15+
For the remainder of the document the Jython installation root will be referred to as ``JYTHON_HOME_DIR``.
1616

1717
Install setuptools
1818
------------------
1919

2020
#. Downlaod `ez_setup.py <http://peak.telecommunity.com/dist/ez_setup.py>`_
2121
#. Execute :file:`ez_setup.py` with the :command:`jython` command::
2222

23-
$ <JYTHON_HOME>/bin/jython ez_setup.py
23+
$ <JYTHON_HOME_DIR>/bin/jython ez_setup.py
2424

2525
Upon success :file:`<JYTYON_HOME>/bin/easy_install` will be created.
2626

@@ -33,11 +33,11 @@ Install virtualenv
3333

3434
#. Using :file:`easy_install` installed in the previous section easy install the virtualenv library::
3535

36-
$ <JYTHON_HOME>/bin/easy_install virtualenv
36+
$ <JYTHON_HOME_DIR>/bin/easy_install virtualenv
3737

3838
#. Create a new virtualenv named ``geoscript``::
3939

40-
$ <JYTHON_HOME>/bin/virtualenv geoscript
40+
$ <JYTHON_HOME_DIR>/bin/virtualenv geoscript
4141

4242
#. Activate the ``geoscript`` virtualenv::
4343

@@ -102,7 +102,7 @@ GeoScript also requires a few Python dependencies.
102102

103103
* Easy install py-dom-xpath::
104104

105-
(geoscript)$ easy_install py-dom-xpath
105+
(geoscript)$ easy_install py-dom-xpath-redux
106106

107107
Install nose
108108
------------

geoscript/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from java.lang import System
33

44
try:
5-
import org.geotools
65
from org.geotools.util.factory import Hints
76

87
# by default the geotools referenceing Systemtem assumes yx or lat/lon

geoscript/geom/bounds.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def __init__(self, west=None, south=None, east=None, north=None, prj=None, env=N
3131
ReferencedEnvelope.__init__(self)
3232

3333
def getwest(self):
34-
return self.minX()
34+
return self.getMinX()
3535
west = property(getwest,None,None,'The leftmost/westmost oordinate of the bounds.')
3636

3737

@@ -41,7 +41,7 @@ def get_l(self):
4141
l = property(get_l, None, None, "Use west.")
4242

4343
def getsouth(self):
44-
return self.minY()
44+
return self.getMinY()
4545
south = property(getsouth,None,None,'The bottomtmost/southmost oordinate of the bounds.')
4646

4747
@deprecated
@@ -50,7 +50,7 @@ def get_b(self):
5050
b = property(get_b, None, None, "Use south.")
5151

5252
def geteast(self):
53-
return self.maxX()
53+
return self.getMaxX()
5454
east = property(geteast,None,None,'The rightmost/eastmost oordinate of the bounds.')
5555

5656
@deprecated
@@ -59,7 +59,7 @@ def get_r(self):
5959
r = property(get_r, None, None, 'Use east.')
6060

6161
def getnorth(self):
62-
return self.maxY()
62+
return self.getMaxY()
6363
north = property(getnorth,None,None,'The topmost/northmost oordinate of the bounds.')
6464

6565
@deprecated

geoscript/layer/layer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from org.geotools.data import Query, Transaction
1515
from org.geotools.factory import CommonFactoryFinder
1616
from org.geotools.util.factory import Hints
17-
from org.geotools.feature import FeatureCollection, FeatureCollections
17+
from org.geotools.feature import FeatureCollection, DefaultFeatureCollection
1818
from org.opengis.filter.sort import SortOrder
1919

2020
_filterFactory = CommonFactoryFinder.getFilterFactory(None)
@@ -162,7 +162,7 @@ def bounds(self, filter=None):
162162
fc = self._source.getFeatures(q)
163163
e = fc.getBounds()
164164
if e:
165-
if e.crs():
165+
if e.getCoordinateReferenceSystem():
166166
return geom.Bounds(env=e)
167167
else:
168168
return geom.Bounds(env=e, prj=self.proj)
@@ -367,7 +367,7 @@ def add(self, o):
367367
elif isinstance(o, (dict,list)):
368368
f = self.schema.feature(o)
369369

370-
fc = FeatureCollections.newCollection()
370+
fc = DefaultFeatureCollection()
371371
fc.add(f._feature)
372372
self._source.addFeatures(fc)
373373

0 commit comments

Comments
 (0)