dwins / geoscript.scala Goto Github PK
View Code? Open in Web Editor NEWScala implementation of the GeoScript API
Home Page: http://geoscript.org/
License: MIT License
Scala implementation of the GeoScript API
Home Page: http://geoscript.org/
License: MIT License
While the GS documentation states it's possible to use px, m and ft as units for the attributes, there does not seem to be any code taking that into account and setting in the symbolizer the right unit of measure.
Refer to: http://docs.geoserver.org/latest/en/user/extensions/css/values.html#numbers
Provide facilities for looking up and inspecting map projections (coordinate reference systems) as well as for transforming geometries between them.
See http://geoscript.org/js/api/proj.html and http://geoscript.org/js/api/proj.html .
http://docs.geoserver.org/latest/en/user/styling/sld-extensions/label-obstacles.html
The property name in CSS should be -gt-label-obstacle
.
The solid fill is propagated also but the empty GraphicFill affects GeoTools rendering and should be removed.
Since CSS is kind of loose syntax-wise it would be good to have a way to list "off" use of the CSS language when creating styles - things like invalid color names, invalid property names, etc. Ideally we could give a list of this kind of problem with locations in the style source so that users can track down issues.
Provide API for accessing and creating data in single and collective datasets (think Shapefile vs. spatial database.)
See http://geoscript.org/js/api/layer.html, http://geoscript.org/js/api/workspace.html, http://geoscript.org/py/api/layer/index.html, and http://geoscript.org/py/api/workspace/index.html.
There is a problem to find xml-apis-xerces-2.7.1 library when building geoscript.
[info] Set current project to default-26d4ba (in build file:/discolocal/roberto/scala/geoscript.scala/geoscript/)
update
[info] Updating {file:/discolocal/roberto/scala/geoscript.scala/geoscript/}default-26d4ba...
[error] OSGeo: bad module name found in http://download.osgeo.org/webdav/geotools/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom: expected='xml-apis-xerces found='xml-apis'
[error] OSGeo: bad revision found in http://download.osgeo.org/webdav/geotools/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom: expected='2.7.1 found='xerces-2.7.1'
[error] OpenGeo: bad module name found in http://repo.opengeo.org/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom: expected='xml-apis-xerces found='xml-apis'
[error] OpenGeo: bad revision found in http://repo.opengeo.org/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom: expected='2.7.1 found='xerces-2.7.1'
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: xml-apis#xml-apis-xerces;2.7.1: several problems occurred while resolving dependency: xml-apis#xml-apis-xerces;2.7.1 {compile=[compile(), master()], runtime=[runtime()]}:
[warn] java.text.ParseException: inconsistent module descriptor file found in 'http://download.osgeo.org/webdav/geotools/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom': bad module name: expected='xml-apis-xerces' found='xml-apis'; bad revision: expected='2.7.1' found='xerces-2.7.1';
[warn] java.text.ParseException: inconsistent module descriptor file found in 'http://repo.opengeo.org/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom': bad module name: expected='xml-apis-xerces' found='xml-apis'; bad revision: expected='2.7.1' found='xerces-2.7.1';
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[info]
[error] :: problems summary ::
[warn] :::: WARNINGS
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: xml-apis#xml-apis-xerces;2.7.1: several problems occurred while resolving dependency: xml-apis#xml-apis-xerces;2.7.1 {compile=[compile(), master()], runtime=[runtime()]}:
[warn] java.text.ParseException: inconsistent module descriptor file found in 'http://download.osgeo.org/webdav/geotools/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom': bad module name: expected='xml-apis-xerces' found='xml-apis'; bad revision: expected='2.7.1' found='xerces-2.7.1';
[warn] java.text.ParseException: inconsistent module descriptor file found in 'http://repo.opengeo.org/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom': bad module name: expected='xml-apis-xerces' found='xml-apis'; bad revision: expected='2.7.1' found='xerces-2.7.1';
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
a style like this causes an unhandled exception:
* {
mark: mark(circle);
}
Provide an API for dealing with (getting and setting attributes of, inspecting and modifying schemas) features.
See http://geoscript.org/js/api/feature.html and http://geoscript.org/py/api/feature/index.html .
Provide an API for dealing with Filters (parsing OGC XML and CQL filter encodings.)
See http://geoscript.org/js/api/filter.html and http://geoscript.org/py/api/filter.html .
Right now colors and sizes default to null, however SLD provides reasonable defaults, e.g., when setting a stroke width to 2 it would make sense to see a black line, not an empty map because the color has not been assigned.
Each symbolizer has basic, meaningful defaults in SLD, CSS should use those.
Currently there is no way to get a RasterSymbolizer out of a CSS style; it would be good to have it for completeness.
[info] Loading project definition from /Users/Shared/geoscript.scala/project/project
[info] Loading project definition from /Users/Shared/geoscript.scala/project
[info] Set current project to root (in build file:/Users/Shared/geoscript.scala/)
compile
[info] Compiling 18 Scala sources to /Users/Shared/geoscript.scala/geoscript/target/scala-2.10/classes...
[error] /Users/Shared/geoscript.scala/geoscript/src/main/scala/layer/Layer.scala:101: not found: value Filter
[error] exclude(Filter.id(
[error] ^
[error] one error found
error Compilation failed
[error] Total time: 10 s, completed Dec 29, 2013 8:09:41 PM
Bring in some concepts from LESS CSS like variables, mix-ins, and nested rules to bring the level of concision up a notch and bring us a little closer to Carto-friendliness.
Currently, 'sbt package' only produces a JAR with geoscript's own libraries. In order to make it easy for folks to get started using geoscript, let's add a release artifact that consists of all the jars needed to make geoscript work.
you can't have a filter with a ]
in it, who wrote this parser anyway?
sample style that should work but doesn't:
[text='array[1]'] { fill: green; }
With a fresh clone of geoscript.scala, and a clean Ivy2 cache (rm -rf ~/.ivy2), I get an error while compiling (and running the examples project):
[error] OSGeo: bad module name found in http://download.osgeo.org/webdav/geotools/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom: expected='xml-apis-xerces found='xml-apis'
[error] OSGeo: bad revision found in http://download.osgeo.org/webdav/geotools/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom: expected='2.7.1 found='xerces-2.7.1'
[error] OpenGeo: bad module name found in http://repo.opengeo.org/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom: expected='xml-apis-xerces found='xml-apis'
[error] OpenGeo: bad revision found in http://repo.opengeo.org/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom: expected='2.7.1 found='xerces-2.7.1'
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: xml-apis#xml-apis-xerces;2.7.1: several problems occurred while resolving dependency: xml-apis#xml-apis-xerces;2.7.1 {compile=[compile(), master()], runtime=[runtime(*)]}:
[warn] java.text.ParseException: inconsistent module descriptor file found in 'http://download.osgeo.org/webdav/geotools/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom': bad module name: expected='xml-apis-xerces' found='xml-apis'; bad revision: expected='2.7.1' found='xerces-2.7.1';
[warn] java.text.ParseException: inconsistent module descriptor file found in 'http://repo.opengeo.org/xml-apis/xml-apis-xerces/2.7.1/xml-apis-xerces-2.7.1.pom': bad module name: expected='xml-apis-xerces' found='xml-apis'; bad revision: expected='2.7.1' found='xerces-2.7.1';
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
It should be possible to include geoscript in the libraryDependencies
in build.sbt
as opposed to a manual download and custom install.
nuff said
Allow users to "import" existing SLD styles as CSS.
Geometries coming from features collections should include projection information.
Features, geometries, and feature collections should be serializable as json, kml and gml object.
dwins' suggestion:
import org.geoscript._
import geometry.writer._
val p = geometry.Point(1, 2)
val json = p as JSON // from geometry.writer
JTS Envelopes (and GeoTools ReferencedEnvelopes) are not wrapped in geoscript.scala. We should sugar them up to be treatable as regular Geometries, supporting reprojection, etc, but with extra Envelope-specific operations such as 'expand to include.'
This should compile.
Create simplified constructors and access methods for jts Geometries. See http://geoscript.org/js/api/geom.html and http://geoscript.org/py/api/geom/index.html for the general API structure in other GeoScript implementations.
Hi,
I am trying to convert OpenStreetMap styles from CartoCSS to GeoServer CSS. But the CSS2SLD converter has strange behaviors. It introduces unexpected rules and it doesn't respect the filters as written. Take this exemple in the bottom of this message. If you look carefully at the generated SLD, the converter has introduces the following errors :
Could you please fix CSS2SLD in a way it respects provided CSS more accurately ? Because I'm currently blocked. The only exit I have is to abort CSS and use SLD directly, what I want to avoid. Thanks alot.
CartoCSS
[way_area >= 150000][zoom >= 14],
[way_area >= 80000][zoom >= 15],
[way_area >= 20000][zoom >= 16],
[zoom >= 17] {
text-name: "[name]";
text-size: 11;
text-fill: #444;
text-face-name: @book-fonts;
text-halo-radius: 1;
text-wrap-width: 20;
text-halo-fill: rgba(255,255,255,0.5);
text-placement: interior;
}
GeoServer CSS :
[way_area > 149999] [@scale < 35000],
[way_area > 79999] [@scale < 15000],
[way_area > 19999] [@scale < 8000],
[@scale < 4000] {
label: [name];
font-family: "DejaVu Sans Book";
font-size: 11;
font-fill: #444;
halo-radius: 1;
halo-color: #FFF;
halo-opacity: 0.5;
}
Generated SLD :
sld:NameDefault Styler/sld:Name
sld:FeatureTypeStyle
sld:Namename/sld:Name
sld:Rule
ogc:Filter
ogc:PropertyIsGreaterThan
ogc:PropertyNameway_area/ogc:PropertyName
ogc:Literal19999/ogc:Literal
/ogc:PropertyIsGreaterThan
/ogc:Filter
sld:MaxScaleDenominator4000.0/sld:MaxScaleDenominator
sld:TextSymbolizer
sld:Label
ogc:PropertyNamename/ogc:PropertyName
/sld:Label
sld:Font
<sld:CssParameter name="font-family">DejaVu Sans Book/sld:CssParameter
<sld:CssParameter name="font-size">11/sld:CssParameter
<sld:CssParameter name="font-style">normal/sld:CssParameter
<sld:CssParameter name="font-weight">normal/sld:CssParameter
/sld:Font
sld:Halo
sld:Radius1/sld:Radius
sld:Fill
<sld:CssParameter name="fill">#FFFFFF/sld:CssParameter
<sld:CssParameter name="fill-opacity">0.5/sld:CssParameter
/sld:Fill
/sld:Halo
sld:Fill
<sld:CssParameter name="fill">#444444/sld:CssParameter
/sld:Fill
/sld:TextSymbolizer
/sld:Rule
sld:Rule
ogc:Filter
ogc:PropertyIsGreaterThan
ogc:PropertyNameway_area/ogc:PropertyName
ogc:Literal19999/ogc:Literal
/ogc:PropertyIsGreaterThan
/ogc:Filter
sld:MinScaleDenominator4000.0/sld:MinScaleDenominator
sld:MaxScaleDenominator8000.0/sld:MaxScaleDenominator
sld:TextSymbolizer
sld:Label
ogc:PropertyNamename/ogc:PropertyName
/sld:Label
sld:Font
<sld:CssParameter name="font-family">DejaVu Sans Book/sld:CssParameter
<sld:CssParameter name="font-size">11/sld:CssParameter
<sld:CssParameter name="font-style">normal/sld:CssParameter
<sld:CssParameter name="font-weight">normal/sld:CssParameter
/sld:Font
sld:Halo
sld:Radius1/sld:Radius
sld:Fill
<sld:CssParameter name="fill">#FFFFFF/sld:CssParameter
<sld:CssParameter name="fill-opacity">0.5/sld:CssParameter
/sld:Fill
/sld:Halo
sld:Fill
<sld:CssParameter name="fill">#444444/sld:CssParameter
/sld:Fill
/sld:TextSymbolizer
/sld:Rule
sld:Rule
ogc:Filter
ogc:PropertyIsGreaterThan
ogc:PropertyNameway_area/ogc:PropertyName
ogc:Literal79999/ogc:Literal
/ogc:PropertyIsGreaterThan
/ogc:Filter
sld:MinScaleDenominator8000.0/sld:MinScaleDenominator
sld:MaxScaleDenominator15000.0/sld:MaxScaleDenominator
sld:TextSymbolizer
sld:Label
ogc:PropertyNamename/ogc:PropertyName
/sld:Label
sld:Font
<sld:CssParameter name="font-family">DejaVu Sans Book/sld:CssParameter
<sld:CssParameter name="font-size">11/sld:CssParameter
<sld:CssParameter name="font-style">normal/sld:CssParameter
<sld:CssParameter name="font-weight">normal/sld:CssParameter
/sld:Font
sld:Halo
sld:Radius1/sld:Radius
sld:Fill
<sld:CssParameter name="fill">#FFFFFF/sld:CssParameter
<sld:CssParameter name="fill-opacity">0.5/sld:CssParameter
/sld:Fill
/sld:Halo
sld:Fill
<sld:CssParameter name="fill">#444444/sld:CssParameter
/sld:Fill
/sld:TextSymbolizer
/sld:Rule
sld:Rule
ogc:Filter
ogc:PropertyIsGreaterThan
ogc:PropertyNameway_area/ogc:PropertyName
ogc:Literal149999/ogc:Literal
/ogc:PropertyIsGreaterThan
/ogc:Filter
sld:MinScaleDenominator15000.0/sld:MinScaleDenominator
sld:MaxScaleDenominator35000.0/sld:MaxScaleDenominator
sld:TextSymbolizer
sld:Label
ogc:PropertyNamename/ogc:PropertyName
/sld:Label
sld:Font
<sld:CssParameter name="font-family">DejaVu Sans Book/sld:CssParameter
<sld:CssParameter name="font-size">11/sld:CssParameter
<sld:CssParameter name="font-style">normal/sld:CssParameter
<sld:CssParameter name="font-weight">normal/sld:CssParameter
/sld:Font
sld:Halo
sld:Radius1/sld:Radius
sld:Fill
<sld:CssParameter name="fill">#FFFFFF/sld:CssParameter
<sld:CssParameter name="fill-opacity">0.5/sld:CssParameter
/sld:Fill
/sld:Halo
sld:Fill
<sld:CssParameter name="fill">#444444/sld:CssParameter
/sld:Fill
/sld:TextSymbolizer
/sld:Rule
sld:Rule
ogc:Filter
ogc:Not
ogc:PropertyIsGreaterThan
ogc:PropertyNameway_area/ogc:PropertyName
ogc:Literal19999/ogc:Literal
/ogc:PropertyIsGreaterThan
/ogc:Not
/ogc:Filter
sld:MaxScaleDenominator4000.0/sld:MaxScaleDenominator
sld:TextSymbolizer
sld:Label
ogc:PropertyNamename/ogc:PropertyName
/sld:Label
sld:Font
<sld:CssParameter name="font-family">DejaVu Sans Book/sld:CssParameter
<sld:CssParameter name="font-size">11/sld:CssParameter
<sld:CssParameter name="font-style">normal/sld:CssParameter
<sld:CssParameter name="font-weight">normal/sld:CssParameter
/sld:Font
sld:Halo
sld:Radius1/sld:Radius
sld:Fill
<sld:CssParameter name="fill">#FFFFFF/sld:CssParameter
<sld:CssParameter name="fill-opacity">0.5/sld:CssParameter
/sld:Fill
/sld:Halo
sld:Fill
<sld:CssParameter name="fill">#444444/sld:CssParameter
/sld:Fill
/sld:TextSymbolizer
/sld:Rule
/sld:FeatureTypeStyle
/sld:UserStyle
[error] /Users/zgalic/geoscript.scala/examples/src/main/scala/example/Postgis.scala:5: object builder is not a member of package org.geoscript.geometry
[error] import org.geoscript.geometry.builder._
[error] ^
[error] one error found
error Compilation failed
Support @rules for top-level declarations. As noted in this geoserver ticket one use would be for style-level metadata like the Title and Name.
GeoServer has a cool feature where you can use a WPS Process to modify data arbitrarily on the fly as part of your style. It would be awesome to support it in CSS. The render-transformations branch is basically ready to go but since GeoTools currently ignores the relevant property when serializing styles it doesn't work well.
A CSS file like this causes a stack overflow:
*{
fill:#B23232;
}
/*
........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
*/
but one character less is okay.
The exception is:
Exception in thread "main" java.lang.StackOverflowError
at java.util.regex.Pattern$CharProperty.match(Unknown Source)
at java.util.regex.Pattern$Branch.match(Unknown Source)
at java.util.regex.Pattern$GroupHead.match(Unknown Source)
at java.util.regex.Pattern$Loop.match(Unknown Source)
at java.util.regex.Pattern$GroupTail.match(Unknown Source)
at java.util.regex.Pattern$BranchConn.match(Unknown Source)
at java.util.regex.Pattern$CharProperty.match(Unknown Source)
at java.util.regex.Pattern$Branch.match(Unknown Source)
at java.util.regex.Pattern$GroupHead.match(Unknown Source)
at java.util.regex.Pattern$Loop.match(Unknown Source)
at java.util.regex.Pattern$GroupTail.match(Unknown Source)
at java.util.regex.Pattern$BranchConn.match(Unknown Source)
at java.util.regex.Pattern$CharProperty.match(Unknown Source)
at java.util.regex.Pattern$Branch.match(Unknown Source)
...
Update to Scala 2.12.x
When making sbt test
the following error appears
problem while downloading module descriptor: http://download.osgeo.org/webdav/geotools/jgridshift/jgridshift/1.0/jgridshift-1.0.pom: invalid sha1: expected=b1368a983af519d0e6ecd8dcbfee651016501f0d computed=88f8cf93af6666f7378131236f8227e48344fed2 (362ms)
Any guidance on how to make this library compile would be greatly appreciated. Thanks in advance
This style creates an SLD with no AnchorPoint, but probably should:
* {
label: [foo];
label-anchor: 0.75 0.75;
}
There is a bit of a conflict with 'label-offset' since it may produce a LinePlacement instead of a PointPlacement. I think when label-offset
indicates a LinePlacement and label-anchor
indicates a PointPlacement we should generate a LinePlacement.
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.