geoscript / geoscript-py Goto Github PK
View Code? Open in Web Editor NEWA Python GeoScript Implementation
Home Page: http://geoscript.net/py
License: MIT License
A Python GeoScript Implementation
Home Page: http://geoscript.net/py
License: MIT License
Installation all worked smoothly. But when I try
>>> import geoscript
I get
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "geoscript/__init__.py", line 2, in <module>
from java.lang import System
ImportError: No module named java.lang
Call through to RendererUtilities.calculateOGCScale(
I get this error:
$ . classpath
ls: cannot access jars/*.jar: No such file or directory
Following instructions here:
http://geoscript.org/py/quickstart.html#install-setuptools
Fails on:
jython ez_setup.py
Failure:
jython ez_setup.py
Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg
Traceback (most recent call last):
File "ez_setup.py", line 278, in <module>
main(sys.argv[1:])
File "ez_setup.py", line 210, in main
egg = download_setuptools(version, delay=0)
File "ez_setup.py", line 158, in download_setuptools
src = urllib2.urlopen(url)
File "/Users/jody/java/jython/Lib/urllib2.py", line 124, in urlopen
return _opener.open(url, data)
File "/Users/jody/java/jython/Lib/urllib2.py", line 387, in open
response = meth(req, response)
File "/Users/jody/java/jython/Lib/urllib2.py", line 497, in http_response
response = self.parent.error(
File "/Users/jody/java/jython/Lib/urllib2.py", line 419, in error
result = self._call_chain(*args)
File "/Users/jody/java/jython/Lib/urllib2.py", line 360, in _call_chain
result = func(*args)
File "/Users/jody/java/jython/Lib/urllib2.py", line 593, in http_error_302
return self.parent.open(new)
File "/Users/jody/java/jython/Lib/urllib2.py", line 381, in open
response = self._open(req, data)
File "/Users/jody/java/jython/Lib/urllib2.py", line 398, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/Users/jody/java/jython/Lib/urllib2.py", line 360, in _call_chain
result = func(*args)
File "/Users/jody/java/jython/Lib/urllib2.py", line 1126, in https_open
return self.do_open(httplib.HTTPSConnection, req)
File "/Users/jody/java/jython/Lib/urllib2.py", line 1093, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (-1, 'SSL exception: Differences between the SSL socket behaviour of cpython vs. jython are explained on the wiki: http://wiki.python.org/jython/NewSocketModule#SSL_Support')>
opacity
shape - for spaced graphics
maxDisplacement
autoWrap
spaceAround
labelAllGroup
forceLeftToRight
conflictResolution
maxAngleDelta
goodnessOfFit
polygonAlign
graphicResize(mode,margin)
Register geoscript on PyPI
GeoServer is upgrading to JTS 1.15.1 and is checking in with our dependencies ask if a new release can be made
rotation
opacity
apply to other symbolizer types
Hoping that this is the right place to ask, given the fact that geoscript.org server has not been working for quite some time now, is there another site hosting the geoscript-py documentation?
Hi @jericks , I saw the geoscript groovy kernel you made about 6 years ago.
Is there any chance to get one for the py version? I have no real idea on how to do this :-) but it would be very cool
I am just getting started with geoscripting so please bare with me.
help(style.Shape)
| >>> Shape('#ff0000', 5)
| Shape(color=(255,0,0),size=5,type=circle)
Straight forward enough
sp = style.Shape("009000", 5)
sp.size
5
sp.color
(0,144,0)
However,
render.draw(point, sp, (1500,500), format='mapwindow')
Throws this error
Traceback (most recent call last):
File "", line 1, in
snip
File "/Users/admin/jython2.5.3/Lib/site-packages/geoscript-1.1-py2.5.egg/geoscript/style/fill.py", line 77, in _fill
fill.setColor(self.color.expr)
TypeError: setColor(): 1st arg can't be coerced to String, org.opengis.filter.expression.Expression
This will do the same >>> sp = style.Shape('red', type='triangle', size=20)
This will work
sp.color
(0,144,0)
sp.color = "#009000"
sp.color
'#009000'
render.draw(point, sp, (1500,500), format='mapwindow')
The CLASSPATH still doesn't resolve GeoTools jars as explained in geoscript-py documentation "Usage" page. I was able to get this working once and can't reproduce it in new bash shells. See workflow below for examples of what I'm doing. If i run 'geoscript' from bash everything works fine in interpreter. But if I try to run jython script from bash using 'jython myscript.py' or run 'jython' interpreter, then the 'import geoscript' triggers "Error: Could not find GeoTools libraries on classpath" even though my classpath is set correctly (see workflow below). The only thing that works for resolving geoscript from jython is to use Eclipse 3.5.1 and PyDev plugin. Then I add external jars to project classpath and everything works. But i should be able to mimic the same thing in the jython interpreter using sys.path.append(all geotools jars). This doesn't work (see workflow below).
gerg ## export JYTHON_HOME=/usr/lib/jython
gerg ## export PATH=/$JYTHON_HOME/bin:$PATH
gerg ## export CLASSPATH='geoscript-classpath'
gerg ## sudo chmod ugo+rwx /usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/*
gerg ## geoscript
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
import geoscript
from geoscript.layer import Shapefile
shp = Shapefile('/home/gregcorradini/GeoTools/FILTERED/centroid_lots.shp')
Jun 13, 2010 9:22:38 AM org.geotools.factory.FactoryRegistry scanForPlugins
WARNING: Can't load a service for category "MathTransformProvider". Cause is "NoClassDefFoundError: javax/media/jai/WarpAffine".
shp
<geoscript.layer.shapefile.Shapefile object at 0x1>
print "Great. that works"
Great. that works
gerg ##
gerg ##
gerg ##
gerg ##
gerg ##
gerg ##
gerg ##
gerg ## jython
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
import geoscript
Error: Could not find GeoTools libraries on classpath.
gerg ##
gerg ##
gerg ## jython
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_20
Type "help", "copyright", "credits" or "license" for more information.
import sys, glob
print "Let's add all jars to sys.path"
Let's add all jars to sys.path
[sys.path.append(i) for i in glob.glob("/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/*.jar")]
[None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None]
sys.path
['', '/usr/lib/jython/Lib/site-packages/setuptools-0.6c11-py2.5.egg', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg', '/usr/lib/jython/Lib', 'classpath', 'pyclasspath/', '/usr/lib/jython/Lib/site-packages', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/commons-collections-3.1.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/common-2.2.1.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/geodb-0.2.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-graph-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-api-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/commons-dbcp-1.2.2.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-epsg-hsql-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-jdbc-spatialite-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-jdbc-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/xml-apis-1.0.b2.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/ecore-2.2.2.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-xsd-ows-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/sqlite-jdbc-3.6.19.1-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/jsr-275-1.0-beta-2.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-jdbc-h2-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/picocontainer-1.2.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-main-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/postgresql-8.4-701.jdbc3.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/commons-beanutils-1.7.0.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/geoapi-2.3-M1.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/jdom-1.0.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-xsd-wfs-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/jts-1.10.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-jdbc-mysql-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-coverage-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/commons-pool-1.5.3.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-shapefile-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-xsd-filter-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/org.w3.xlink-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-cql-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/vecmath-1.3.2.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-xsd-core-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-render-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-directory-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/xml-apis-xerces-2.7.1.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/net.opengis.wfs-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-xsd-gml2-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/xercesImpl-2.7.1.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/commons-logging-1.0.3.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/mysql-connector-java-5.1.5.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/xsd-2.2.2.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-data-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-metadata-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/net.opengis.ows-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/ant-optional-1.5.1.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/geoapi-pending-2.3-M1.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/h2-1.1.104.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/hatbox-1.0.b6.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-xsd-gml3-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/commons-jxpath-1.2.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-referencing-2.7-SNAPSHOT.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/hsqldb-1.8.0.7.jar', '/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/jars/gt-jdbc-postgis-2.7-SNAPSHOT.jar']
import geoscript
from geoscript.layer import Shapefile
shp = Shapefile('/home/gregcorradini/GeoTools/FILTERED/centroid_lots.shp')
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/geoscript/layer/shapefile.py", line 21, in init
Layer.init(self, name, Directory(f.canonicalFile.parent))
File "/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/geoscript/workspace/directory.py", line 21, in init
Workspace.init(self, DirectoryDataStoreFactory(), params)
File "/usr/lib/jython/Lib/site-packages/geoscript-0.6-py2.5.egg/geoscript/workspace/workspace.py", line 22, in init
self.ds = factory.createDataStore(params)
at org.geotools.data.directory.DirectoryDataStoreFactory.canProcess(DirectoryDataStoreFactory.java:91)
at org.geotools.data.directory.DirectoryDataStoreFactory.createDataStore(DirectoryDataStoreFactory.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at
java.lang.reflect.Method.invoke(Method.java:597)
java.lang.ExceptionInInitializerError: java.lang.ExceptionInInitializerError
For example:
new Shape("#FF0000", 6, "circle").stroke("#000000",2)
for instance for jpeg, which does not support transparency, also useful to allow the user to specify this
So that you can do things like:
Stroke(...) + Hatch('...)
Geoscript Groovy has a geoscript.index package for spatial index support.
https://github.com/geoscript/geoscript-groovy/tree/master/src/main/groovy/geoscript/index
https://jericks.github.io/geoscript-groovy-cookbook/#spatial-index-recipes
Initially, we should support JTS's QuadTree, and STRtree spatial index classes.
Geotools and GeoServer are using the OSGeo Repository
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.