Hello Yang,

For approximately even point spacing you could do this...

// for each feature
Geometry line = (Geometry) lineFeature.getDefaultGeometry();
Geometry lineWithExtraVertices = Densifier.densify(line, maxPointSpacing);
Coordinate[] pointCoords = lineWithExtraVertices.getCoordinates();

See javadocs for the Densifier class:
http://tsusiatsoftware.net/jts/javadoc/com/vividsolutions/jts/densify/Densifier.html

You don't say whether you want to work with the output points as
Geometry (Point) objects or create SimpleFeatures from them. If the
former, you could use the Geometry.setUserData method to store the id
of the parent line feature. If the latter, you can obviously just have
a point feature attribute for the parent id.

Michael


On 20 February 2012 21:41, Y_Wang <murielw...@hotmail.com> wrote:
> dear all,
>
> Is there any way we can create points along some input lines? just like
> v.to.points in GRASS. If there is more than one input lines, it would be
> good to preserve the line id to each set of points. Any one can point me a
> direction?
>
> Many Thanks,
>
> Yang
>
> --
> View this message in context: 
> http://osgeo-org.1560.n6.nabble.com/create-points-along-input-lines-tp4487334p4487334.html
> Sent from the geotools-gt2-users mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to