To clarify my problem, here is the code.
1) Coordinate co1 = new Coordinate(xsource,ysource);
Coordinate co2 = new Coordinate(xdest, ydest);
Node source = featureGen.getNode(co1); // This gives an error as there is no getNode function for a FeatureGraphGenerator
Node dest = featureGen.getNode(co2);
2) Graph bgraph = featureGen.getGraph();
3) AStarShortestPathFinder astar = new AStarShortestPathFinder(bgraph, source, dest, afuncs);
4) astar.calculate();
5) Path p = astar.getPath();
6) for(Iterator itr = p.getEdges().iterator();itr.hasNext();)
{
Edge e = (Edge)itr.next();
System.out.println("Edge is from "+ e.getNodeA() + "to "+ e.getNodeB());
}
Please suggest me a fix for the error in Point 1 and suggest me any fix if there is any flaw in the rest of the code.
Thank You.
Harshad Shrikhande
Researcher R&D
TCS Innovations Infra Lab, Chennai
Tata Consultancy Services
Cell:- 7200605821
Mailto: harsha...@tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________
-----Harshad S
To: michael.bedw...@gmail.com
From: Harshad S <harsha...@tcs.com>
Date: 09/29/2011 04:37PM
cc: geotools-gt2-users@lists.sourceforge.net
Subject: Re: [Geotools-gt2-users] Fw: Reg Graph Issues in Geotools
Hi,
Now, the issue is that I add the features into an object of type 'FeatureGraphGenerator'. My AStarShortestPathFinder function needs the source and destination points to be of type 'Node'. I have the coordinates of the source and dest points and I want to get their 'Nodes' from the FeatureGraphGenerator. But it doesn't have a 'getNode' function for doing so. Please suggest how can I fix this.
Thank You.
Harshad Shrikhande
Researcher R&D
TCS Innovations Infra Lab, Chennai
Tata Consultancy Services
Cell:- 7200605821
Mailto: harsha...@tcs.com
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________
-----Michael Bedward wrote: -----To: Harshad S <harsha...@tcs.com>
From: Michael Bedward <michael.bedw...@gmail.com>
Date: 09/29/2011 04:16PM
cc: geotools-gt2-users@lists.sourceforge.net
Subject: Re: [Geotools-gt2-users] Fw: Reg Graph Issues in GeotoolsHello Harshad,
On the user guide page about the graph module, just above the section
about building a graph from LineSegments (which is perhaps the example
you have followed) there is an example of using
LineStringGraphGenerator for features with LineString geometries:
http://docs.geotools.org/latest/userguide/extension/graph/index.html#building-graph-from-a-featurecollection
Michael
On 29 September 2011 19:50, Harshad S <harsha...@tcs.com> wrote:
> Hi,
>
> Jut to clarify my doubt, my shapefile has over 3000 features. So my
> 'SimpleFeatureSource' is getting populated with the features. Now, the
> shapefile that I am uploading is of a road network. So, I suppose the
> 'generator' is not getting populated because the features are not of the
> type 'LineSegment' probably as the 'add' method of a 'generator' takes a
> 'LineSegment' as its parameter.
> Please suggest me the possible workaround for this.
>
> Thank You.
> Harshad Shrikhande
> Researcher R&D
> TCS Innovations Infra Lab, Chennai
> Tata Consultancy Services
> Cell:- 7200605821
> Mailto: harsha...@tcs.com
> Website: http://www.tcs.com
> ____________________________________________
> Experience certainty. IT Services
> Business Solutions
> Outsourcing
> ____________________________________________
>
> -----Forwarded by Harshad S/TVM/TCS on 09/29/2011 03:18PM -----
>
> To: geotools-gt2-users@lists.sourceforge.net
> From: Harshad S <harsha...@tcs.com>
> Date: 09/29/2011 02:40PM
> Subject: [Geotools-gt2-users] Reg Graph Issues in Geotools
>
> Hi,
> I am new to Geotools and its graph plugin. I am trying to find the
> shortest path between 2 points on a map. Following is the code for it. But
> there's an issue as the graph is not getting constructed from the shapefile
> and thus the 'generator' variable shows NULL value.
>
>
> 1) File file = JFileDataStoreChooser.showOpenFile("shp", null)
> 2) FileDataStore store = null;
> 3) store = FileDataStoreFinder.getDataStore(file);
> 4) SimpleFeatureSource featureSource = store.getFeatureSource()
> 5) LineGraphGenerator generator = new BasicLineGraphGenerator ()
> 6) SimpleFeatureCollection fc = featureSource.getFeatures();
> fc.accepts(new FeatureVisitor() {
>
> public void visit(Feature arg0) {
> // TODO Auto-generated method stub
> generator.add(arg0) ;
> }
> }, null);
>
> Now, the generator is not getting populated with the graph from the
> shapefile. Please correct me I am missing something here.
>
>
> Thank You.
> Harshad Shrikhande
> Researcher R&D
> TCS Innovations Infra Lab, Chennai
> Tata Consultancy Services
> Cell:- 7200605821
> Mailto: harsha...@tcs.com
> Website: http://www.tcs.com
> ____________________________________________
> Experience certainty. IT Services
> Business Solutions
> Outsourcing
> ____________________________________________
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
>
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure contains a
> definitive record of customers, application performance, security
> threats, fraudulent activity and more. Splunk takes this data and makes
> sense of it. Business sense. IT sense. Common sense.
> http://p.sf.net/sfu/splunk-d2dcopy1
> _______________________________________________
> Geotools-gt2-users mailing list
> Geotools-gt2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
>------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users