Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ env
tests/dbexts.ini
scripts
site
.idea/
*.iml
build/
*.jython_cache
16 changes: 0 additions & 16 deletions bin/geoscript

This file was deleted.

16 changes: 16 additions & 0 deletions bin/geoscript-py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

JYTHON=""
if [ "$JYTHON_HOME_DIR" != "" ] && [ -e $JYTHON_HOME_DIR/jython ]; then
JYTHON=$JYTHON_HOME/bin/jython
else
which jython > /dev/null
if [ "$?" == "1" ]; then
echo "JYTHON_HOME_DIR not defined and jython not on the current PATH"
exit -1
fi
JYTHON=`which jython`
fi

export CLASSPATH=`geoscript-py-classpath`
$JYTHON
File renamed without changes.
32 changes: 32 additions & 0 deletions bin/geoscript-py.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@ECHO OFF

REM SETLOCAL ENABLEDELAYEDEXPANSION

REM ensure JYTHON_HOME_DIR set
IF NOT DEFINED JYTHON_HOME_DIR (
GOTO NO_JYTHON_HOME
)

REM ensure jython.bat can be found
SET JYTHON_EXE="%JYTHON_HOME_DIR%\jython.bat"
IF NOT EXIST %JYTHON_EXE% (
GOTO NO_JYTHON
)

REM run geoscript-classpath script
FOR /f "tokens=*" %%X IN ('%JYTHON_EXE% %~dp0geoscript-py-classpath') DO (
SET CLASSPATH=%%X
)

%JYTHON_EXE%
SET JYTHON_EXE=

:NO_JYTHON_HOME
ECHO Error, JYTHON_HOME_DIR is unset. Please set JYTHON_HOME_DIR to root of Jython installation.
GOTO DONE

:NO_JYTHON
ECHO Error, JYTHON_HOME_DIR was set but could not find 'jython' exe.
GOTO DONE

:DONE
32 changes: 0 additions & 32 deletions bin/geoscript.bat

This file was deleted.

12 changes: 6 additions & 6 deletions doc/devel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ This section describes how to set up a GeoScript development environment.
Install Jython
--------------

Jython version 2.5.1 or greater is required for GeoScript.
Jython version 2.7.2 or greater is required for GeoScript.

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

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

Install setuptools
------------------

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

$ <JYTHON_HOME>/bin/jython ez_setup.py
$ <JYTHON_HOME_DIR>/bin/jython ez_setup.py

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

Expand All @@ -33,11 +33,11 @@ Install virtualenv

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

$ <JYTHON_HOME>/bin/easy_install virtualenv
$ <JYTHON_HOME_DIR>/bin/easy_install virtualenv

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

$ <JYTHON_HOME>/bin/virtualenv geoscript
$ <JYTHON_HOME_DIR>/bin/virtualenv geoscript

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

Expand Down Expand Up @@ -102,7 +102,7 @@ GeoScript also requires a few Python dependencies.

* Easy install py-dom-xpath::

(geoscript)$ easy_install py-dom-xpath
(geoscript)$ easy_install py-dom-xpath-redux

Install nose
------------
Expand Down
1 change: 0 additions & 1 deletion geoscript/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from java.lang import System

try:
import org.geotools
from org.geotools.util.factory import Hints

# by default the geotools referenceing Systemtem assumes yx or lat/lon
Expand Down
8 changes: 4 additions & 4 deletions geoscript/geom/bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, west=None, south=None, east=None, north=None, prj=None, env=N
ReferencedEnvelope.__init__(self)

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


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

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

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

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

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

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

@deprecated
Expand Down
6 changes: 3 additions & 3 deletions geoscript/layer/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from org.geotools.data import Query, Transaction
from org.geotools.factory import CommonFactoryFinder
from org.geotools.util.factory import Hints
from org.geotools.feature import FeatureCollection, FeatureCollections
from org.geotools.feature import FeatureCollection, DefaultFeatureCollection
from org.opengis.filter.sort import SortOrder

_filterFactory = CommonFactoryFinder.getFilterFactory(None)
Expand Down Expand Up @@ -162,7 +162,7 @@ def bounds(self, filter=None):
fc = self._source.getFeatures(q)
e = fc.getBounds()
if e:
if e.crs():
if e.getCoordinateReferenceSystem():
return geom.Bounds(env=e)
else:
return geom.Bounds(env=e, prj=self.proj)
Expand Down Expand Up @@ -367,7 +367,7 @@ def add(self, o):
elif isinstance(o, (dict,list)):
f = self.schema.feature(o)

fc = FeatureCollections.newCollection()
fc = DefaultFeatureCollection()
fc.add(f._feature)
self._source.addFeatures(fc)

Expand Down
15 changes: 9 additions & 6 deletions geoscript/render/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from geoscript import geom, proj, style
from geoscript.layer import Raster
from org.geotools.geometry.jts import ReferencedEnvelope
from org.geotools.map import DefaultMapContext, DefaultMapLayer
from org.geotools.map import MapContent, FeatureLayer, GridCoverageLayer
from org.geotools.renderer.lite import StreamingRenderer

class RendererBase:
Expand All @@ -12,13 +12,16 @@ class RendererBase:
"""

def render(self, layers, styles, bounds, size, **options):
self.map = DefaultMapContext(bounds.proj._crs)
self.map.setAreaOfInterest(bounds)
self.map = MapContent()
self.map.getViewport().setCoordinateReferenceSystem(bounds.proj._crs)
self.map.getViewport().setBounds(bounds)

for i in range(len(layers)):
l = layers[i]
l = layers[i]

data = l._coverage if isinstance(l,Raster) else l._source
self.map.addLayer(DefaultMapLayer(data, styles[i]._style()))
mapLayer = GridCoverageLayer(data, styles[i]._style()) if isinstance(l,Raster) else FeatureLayer(data, styles[i]._style())
self.map.addLayer(mapLayer)

w,h = (size[0], size[1])

Expand All @@ -27,7 +30,7 @@ def render(self, layers, styles, bounds, size, **options):

renderer = StreamingRenderer()
renderer.setJava2DHints(awt.RenderingHints(hints))
renderer.setContext(self.map)
renderer.setMapContent(self.map)

img = image.BufferedImage(w, h, image.BufferedImage.TYPE_INT_ARGB)
g = img.getGraphics()
Expand Down
9 changes: 5 additions & 4 deletions geoscript/render/mapwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from javax import swing
from geoscript import geom, proj, style
from org.geotools.geometry.jts import ReferencedEnvelope
from org.geotools.map import DefaultMapContext, DefaultMapLayer
from org.geotools.map import MapContent, Layer
from org.geotools.renderer.lite import StreamingRenderer
from org.geotools.swing import JMapPane
from org.geotools.swing.action import *
Expand All @@ -20,11 +20,12 @@ def __init__(self):
pass

def render(self, layers, styles, bounds, size, **options):
self.map = DefaultMapContext(bounds.proj._crs)
self.map.setAreaOfInterest(bounds)
self.map = MapContent()
self.map.getViewport().setCoordinateReferenceSystem(bounds.proj._crs)
self.map.getViewport().setBounds(bounds)

for i in range(len(layers)):
self.map.addLayer(DefaultMapLayer(layers[i]._source,styles[i]._style()))
self.map.addLayer(Layer(layers[i]._source,styles[i]._style()))

w,h = (size[0], size[1])

Expand Down
3 changes: 2 additions & 1 deletion geoscript/style/icon.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import mimetypes
import mimetypes
from geoscript.util import toURL
from geoscript.style import util
from geoscript.style.symbolizer import Symbolizer
Expand Down Expand Up @@ -37,7 +38,7 @@ def _apply(self, sym):
g = util.graphic(sym)
if self.size:
g.size = self.size.expr
g.setMarks([])
g.graphicalSymbols().clear()
if g:
g.graphicalSymbols().add(eg)

Expand Down
2 changes: 1 addition & 1 deletion geoscript/style/stroke.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def interpolate(self, stroke, n=10, method='linear'):
def _prepare(self, rule):
sym = self.factory.createLineSymbolizer()
self._apply(sym)
rule.addSymbolizer(sym)
rule.symbolizers().add(sym)

def _apply(self, sym):
Symbolizer._apply(self, sym)
Expand Down
2 changes: 1 addition & 1 deletion geoscript/style/symbolizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _style(self):
for fil in ftbl.keys():
syms = ftbl[fil]
rule = self.factory.createRule()
fts.addRule(rule)
fts.rules().add(rule)
if scale[0] > -1:
rule.setMinScaleDenominator(scale[0])
if scale[1] > -1:
Expand Down
Loading