I did not see it added to your calculation yet, but here is an advanced
distance optimisation technique that can be used to avoid the bbox
limitation.

Grab a high level road network (say freeways and major roads) and put it
together as a separate data set. You can simplify the dataset so that one
road made up of 5 features with no branches ends up being represented as
one feature with the total distance of the original five features.

You then do three queries to build you graph.

1) the "major" road network for the country or state you are working in
2) a bbox query around the start against the full road network
3) a bbox query around the end against the full road network

And use the same builder producing a single network out of the three
feature collections, the result is a network that is faster to calculate
through in graph space.

Cheers,
Jody

Jody Garnett


On Mon, Jul 21, 2014 at 1:17 AM, 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
>
>
------------------------------------------------------------------------------
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