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
>>
>>
>
------------------------------------------------------------------------------
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

Reply via email to