Yeah, i will have to pay extra attention to the envelope box setup for not
loosing the route.
In theory this looks pretty easy but the implementation already creates
issues for me. Do you happen to know a way i can setup that tilted
rectangular box? Some tips would really help, me cause i kinda looked
everywhere and i  am stuck.


On Mon, Jul 21, 2014 at 11:36 AM, Frank van der Hulst <
drifter.fr...@gmail.com> wrote:

> Hi Elena,
>
> I did more or less what you mentioned... the Envelope 'limits' in my code
> is the corners of the box. One thing to watch... the route between the
> points may wander outside the box, so maybe allow a fudge factor of 10% of
> the width & height. Unlike your box, mine is just grid-aligned... I guessed
> that the processing cost of identifying segments within a specified
> distance of the desired line would be higher than doing a bit of extra work
> in my own code. But your way may well be better.
>
> In my project, I was happy to find a reasonably good route between the
> points, without needing to find the absolute shortest route. So I built a
> tree, starting at one point and growing towards the other, more or less
> Dijkstra's algorithm, but stopping when I found any route through the
> graph. I sorted the segments I'd got from the ShapeFile, evaluating the
> segments based on their lengths (longer is better) and direction (aligned
> in the direction I want to go is better), so that better segments would be
> checked first.
>
> Some things to watch for here... segments that intersect to other segments
> at non-vertices, and multiple paths to the same point.
>
>
> On Mon, Jul 21, 2014 at 8:17 PM, Elena Pop <elena0...@gmail.com> wrote:
>
>> Hi Frank,
>>
>> I am still working to obtain the best time for route calculation. The
>> records filtering is doing a pretty good job but i am wondering if i can
>> optimize it more. Basically how it works now, it cuts a big rectangular
>> form with the opposite corners marked by the start and the ending points of
>> the route .
>> Is it possible to filter the records in a way that the graph that i will
>> process afterwards would look like the one marked by the black rectangle
>> from this screenshot http://screencast.com/t/X3wuEcNs ?
>>
>>
>> On Fri, Jul 11, 2014 at 11:17 AM, Elena Pop <elena0...@gmail.com> wrote:
>>
>>> Thank you very much Frank. It does work pretty well.
>>>
>>>
>>> On Thu, Jul 10, 2014 at 9:12 PM, Frank van der Hulst <
>>> drifter.fr...@gmail.com> wrote:
>>>
>>>> Hi Elena,
>>>> You can filter the records that are pulled from the Shapefile... try
>>>> this...
>>>>
>>>>
>>>>
>>>>
>>>>   /**
>>>>    * Open an Shapefile
>>>>    *
>>>>    * @param String filepath
>>>>    * @param Envelope limits
>>>>    */
>>>>     FileDataStore store;
>>>>   SimpleFeatureSource featureSource;
>>>>   public SimpleFeatureCollection srcCollection;
>>>>    File file = new File(filepath);
>>>>     try {
>>>>       store = FileDataStoreFinder.getDataStore(file);
>>>>       featureSource = store.getFeatureSource();
>>>>       Filter filter = CQL.toFilter("BBOX(the_geom, " + limits.getMinX()
>>>> + ", " + limits.getMinY() + ", " + limits.getMaxX() + ", " +
>>>> limits.getMaxY() + ")");
>>>>       Query query = new Query();
>>>>       query.setFilter(filter);
>>>>       query.setHints(new Hints(Hints.FEATURE_2D, Boolean.TRUE)); //
>>>> force 2D data
>>>>       srcCollection = featureSource.getFeatures(filter);
>>>>     } catch (CQLException | IOException ex) {
>>>>       // Handle errors
>>>>     }
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Jul 11, 2014 at 12:04 AM, Elena Pop <elena0...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hi,
>>>>> I have been working on a project that has to find a route between 2
>>>>> points using algorithms like Dijkstra or A*.
>>>>> The project is working, however, the processing time since the
>>>>> destination/source insertion and the retrieval of the route its a bit too
>>>>> much: 8s and i have to reduce it to max 2s.
>>>>> Now, the graph that is created based on a shapefile is pretty huge.
>>>>> After running tests, by cutting the shapefile, and thus reducing the 
>>>>> graph,
>>>>> i figured out i can get results in less than 1s which is awesome.
>>>>>
>>>>> So for that i need a dynamic fast way to select a certain part of the
>>>>> graph like a bounding box with the 2 points as parameters and run the
>>>>> algorithm in it.
>>>>>
>>>>> Is there something that you could recommend? I did try to process the
>>>>> shapefile by cutting it with ogr2ogr but that takes some time also so it 
>>>>> is
>>>>> not a solution for me.
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Open source business process management suite built on Java and Eclipse
>>>>> Turn processes into business applications with Bonita BPM Community
>>>>> Edition
>>>>> Quickly connect people, data, and systems into organized workflows
>>>>> Winner of BOSSIE, CODIE, OW2 and Gartner awards
>>>>> http://p.sf.net/sfu/Bonitasoft
>>>>> _______________________________________________
>>>>> GeoTools-GT2-Users mailing list
>>>>> GeoTools-GT2-Users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>>>
>>>>>
>>>>
>>>
>>
>
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to