Hi Justin,thanks for the clarification, that makes it clear now. Indeed, that is how I create my graph, using a LineGraphGenerator passed to a FeatureGraphGenerator.
Thanks for the help!
Martin On 9/1/2010 7:02 PM, Justin Deoliveira wrote:
On Wed, Sep 1, 2010 at 11:41 AM, Martin Tomko <[email protected] <mailto:[email protected]>> wrote:Dear Justin, thanks, that's exactly what I needed - I know that the JTS geometry will be in whatever the native units are , that's fine with me. Would it be possible to update the javadoc to say tha the Object is actually the geometry? I was suspecting that, but was not sure whether it is the original feature or the geometry.Well the object depends on how the graph was built, and what the nodes and edges in the graph are modelling. But yeah, could probably use an example right in the javadoc.Is there any equivalent method to get back to the generating feature (so that one could get some of the other attributes, maybe containing other values for weights?)Again it depends on how you built the graph. What I suggest you do is build your graph using a FeatureGraphGenerator that gets passed a LineGraphGenerator. This will create graph the same way but the edge objects will be the features themselves. And you can access them accordingly.Thanks Martin On 9/1/2010 5:20 PM, Justin Deoliveira wrote:Hi Martin, Yeah you should be able to get at the underlying LineString by calling e.getObject(). Something like: DijkstraIterator.EdgeWeigter weighter =new DijkstraIterator.EdgeWeighter() { public double getWeight(Edge e) { LineString l = (LineString) e.getObject(); return l.getLength(); } } However the linestring has no notion of units. That will depend on whatever coordinate system your data is in. On Wed, Sep 1, 2010 at 10:55 AM, Martin Tomko <[email protected] <mailto:[email protected]>> wrote: Dear All, I am using the Graph api to construct a graph based on lineStrings - that works perfectly. I would like to do a shortest path computation based on geographical distance, and need to implement a Weighter. the docs show this snippet: DijkstraIterator.EdgeWeigter weighter =new DijkstraIterator.EdgeWeighter() { public double getWeight(Edge e) { return 1.0;//constant } } which results in a constant weight for an edge of 1. How do I get the actual length of an edge, in the original feature's units... I need the values also for other purposes, so really neend to access the edge length property. Is it possible? Thanks Martin ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Geotools-gt2-users mailing list [email protected] <mailto:[email protected]> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users-- Justin DeoliveiraOpenGeo - http://opengeo.org Enterprise support for open source geospatial.-- Martin TomkoPostdoctoral Research Assistant Geographic Information Systems Division Department of Geography University of Zurich - Irchel Winterthurerstr. 190 CH-8057 Zurich, Switzerland email: [email protected] <mailto:[email protected]> site: http://www.geo.uzh.ch/~mtomko <http://www.geo.uzh.ch/%7Emtomko> mob: +41-788 629 558 tel: +41-44-6355256 fax: +41-44-6356848 -- Justin Deoliveira OpenGeo - http://opengeo.org Enterprise support for open source geospatial.
-- Martin Tomko Postdoctoral Research Assistant Geographic Information Systems Division Department of Geography University of Zurich - Irchel Winterthurerstr. 190 CH-8057 Zurich, Switzerland email: [email protected] site: http://www.geo.uzh.ch/~mtomko mob: +41-788 629 558 tel: +41-44-6355256 fax: +41-44-6356848
------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
