Milton Jonathan wrote:
> Hello people
>
> I have a (common?) practical problem where I have spatial data (with 
> some attributes) on one side (e.g., a shapefile, or a spatial table in a 
> database), and a bunch of related information that's being stored 
> somewhere else (e.g., a regular table in a database that has an FID 
> column matching those in the spatial table).
>
> So I ask: what is the most usual way in GeoTools for "glueing" or 
> linking these two sets of data? 
Brute force and a for loop :-)  If you need to join on spatial data take 
one data set and stuff the geometries in a JTS Spatial index to save 
time. If you can do it based on ID then a HashSet will be your friend.

If you check into the validation module you can see lots of painful slow 
examples of doing things this way.
> table). I guess that, when everything is within a single database, one 
> can create a view that already joins these data beforehand, and the 
> feature source would then be that view. Or is there a better way of 
> doing this?
>   
Correct; that is a common solution when the data is in the same database.
> Anyway, I am not sure if this is really within the scope GeoTools 
> itself, but it looks like a very common problem and so maybe someone has 
> already thought of some mechanisms in GeoToools to help with that..
>
>   
It is in scope and there have been a few attempts at solving it - but 
nothing successful so far. The author of JTS Topology Suite has a pretty 
interesting project in this regard (a small domain specific language 
that supports joins and stuff) - but you can go ask about that on the 
JTS email list cause I do not have the details.

My best solution would be to load stuff into a local H2 database and 
hack away; but I am waiting for someone bright to add a spatial index to 
H2 before even trying that.

Jody

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to