I'm trying to use CQL, but it doesn't work:
synbolizer.setGeometry(ECQL.toExpression("point(" + strXAttributeName + "," +
strYAttributeName + ")"));
The error is: encountered X when expecting ...
This doesn't work either:
synbolizer.setGeometry(ECQL.toExpression("geomFromWKT(point(" +
strXAttributeName + "," + strYAttributeName + "))"));
Ron
________________________________
From: Jody Garnett <[email protected]>
To: Ron Lindhoudt <[email protected]>
Cc: "[email protected]"
<[email protected]>
Sent: Wednesday, November 7, 2012 2:26 PM
Subject: Re: [Geotools-gt2-users] Construct Geometry from X, Y attribute (using
geomFromWKT?)
We have a range of functions that are able to create a geometry, including a
"point" function:
final Expression pointExpression = ff.function("point, ff.properaty("X"),
ff.property("Y") );
Point point = pointExpression.evaulate( feature, Point.class );
Or CQL: point( X, Y )
However my statement still stands, you can use a geometry factory, while
visiting a feature collection to create points.
final Expression xpath = ff.property("X");
final Expression ypath = ff.property("Y");
featureCollection.accepts( new FeatureVisitor(){
public void visit( Feature feature ){
Double x = xpath.evaualte( feature, Double.class );
Double y = ypath.evaualte( feature, Double.class );
Point pt = gf.createPoint( x,y );
}
}, null );
--
Jody Garnett
On Wednesday, 7 November 2012 at 5:28 PM, Ron Lindhoudt wrote:
Hi Jody,
>
>I mean dynamically, based on a column attribute in a table. Like in an
>ExternalGraphic where you can reference an attribute ${ATT_NAME}.png for the
>URL
>
>
>
>Ron
>
>
>
>
>________________________________
> From: Jody Garnett <[email protected]>
>To: Ron Lindhoudt <[email protected]>
>Cc: "[email protected]"
><[email protected]>
>Sent: Wednesday, November 7, 2012 2:46 AM
>Subject: Re: [Geotools-gt2-users] Construct Geometry from X, Y attribute
>(using geomFromWKT?)
>
>
>Use a GeometryFactory directly?
>
>
>The documentation has many examples of how t o create a point, including with
>WKT:
>
>
>- http://docs.geotools.org/latest/userguide/library/jts/geometry.html#creating-a-point
>
>
>--
>Jody Garnett
>
>
>
>On Tuesday, 6 November 2012 at 5:55 PM, Ron Lindhoudt wrote:
>Hello,
>>
>>
>>Is it possible to construct a Geometry from X, Y attribute in a table?
>>I tried some function expressions for setGeometry, but they don't work:
>>
>>
>>String strExpression = "geomFromWKT('Point(X Y)')";
>>// or
>>
>>String strExpression = "geomFromWKT('Point(${X} ${Y})')";
>>
>>
>>rule.getSymbolizers()[0].setGeometry(ECQL.toExpression(strExpression));
>>
>>
>>Thanks for any input.
>>
>>Ron
>>
>>------------------------------------------------------------------------------
>>LogMeIn Central: Instant, anywhere, Remote PC access and management.
>>Stay in control, update software, and manage PCs from one command center
>>Diagnose problems and improve visibility into emerging IT issues
>>Automate, monitor and manage. Do more in less time with Central
>>http://p.sf.net/sfu/logmein12331_d2d
>>_______________________________________________
>>GeoTools-GT2-Users mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>
>
> ------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users