That looks like https://osgeo-org.atlassian.net/projects/GEOT/issues/GEOT-5262 which I fixed 3 days ago so the latest 14 and 15 snapshots should work for you now.
Ian On 4 November 2015 at 02:11, Ben Caradoc-Davies <[email protected]> wrote: > João, > > your exception stack trace is most useful but the line numbers do not seem > to make sense on master (GeoTools 15-SNAPSHOT). > > What version of GeoTools are you using? Are you using Maven? Have you > tried debugging the program in Eclipse? This will tell you exactly what is > happening at the moment of the exception. Be sure to first run > > mvn -DdownloadSources eclipse:eclipse > > to ensure Eclipse has the attached sources so debugging makes sense. > > Kind regards, > Ben. > > On 04/11/15 10:45, João Bandeira wrote: > >> Sorry for bothering you guys again with this, but does anyone know what >> my problem could be? >> >> Thanks and best regards >> João Norim >> >> From: [email protected] >> To: [email protected] >> Date: Thu, 29 Oct 2015 16:09:29 +0000 >> CC: [email protected] >> Subject: Re: [Geotools-gt2-users] Doubts about geotools usage. University >> project. >> >> >> >> >> Thanks Ian! That should help me a lot! >> >> I've already tried to implement that code, but I'm having some problems >> with it... Every time I run it, i get a NullPointerException... >> >> Here are some details about what I've done: >> code: http://pastebin.com/fM7DNDfw >> sample data: http://pastebin.com/7ynCykXc (this is data taken from the >> file I have) >> exception details: http://pastebin.com/MTj9YjjH >> >> I don't know if it has something to do with it, but the System.out which >> prints the filter prints something like "POLYGON(.....", and in the data I >> have, the geometry field has somthing like "MULTILINESTRING(....". Could >> this be the problem? If so, how can I get around it? >> >> Thanks and best regards >> João Norim >> >> PS: I think the only thing I forgot in the pastebin with the code was the >> geometry factory I'm using. I'm using this one: >> GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(); >> >> Date: Thu, 29 Oct 2015 15:18:51 +0000 >> Subject: Re: [Geotools-gt2-users] Doubts about geotools usage. University >> project. >> From: [email protected] >> To: [email protected] >> CC: [email protected] >> >> You could do something like this: >> public List<SimpleFeature> search(Point p) { >> List<SimpleFeature> ret = new ArrayList<>(); Coordinate[] coords >> = new Coordinate[5]; double tol = 0.001; double >> left = p.getX() - tol; double right = p.getX() + tol; >> double bot = p.getY() - tol; double top = p.getY() + tol; >> coords[0] = coords[4] = new Coordinate(left, bot); >> coords[1] = new Coordinate(right, bot); coords[2] = new >> Coordinate(right, top); coords[3] = new Coordinate(left, top); >> Polygon poly = geometryFactory.createPolygon(coords); >> Intersects filter = FF.intersects(FF.literal(poly), >> FF.property(geomName)); System.out.println(filter); >> try { SimpleFeatureCollection features = >> featureSource.getFeatures(filter); >> ret.addAll(DataUtilities.list(features)); } catch >> (IOException e) { // TODO Auto-generated catch block >> e.printStackTrace(); } return >> ret; } >> Note the need to make the point "bigger" otherwise it probably won't ever >> hit a line. >> Ian >> On 29 October 2015 at 10:16, João Bandeira <[email protected]> wrote: >> >> >> >> Hi! >> >> My name is João, I'm from Portugal, and I'm a Software and Computer >> Engineering student at FEUP. I'm contacting you about GeoTools. >> >> I'm contacting users through the email list as a suggestion given by >> Andrea, one of the geotools developers. >> >> I'm currently developing a project for college where I have to interpret >> a map of the rivers in my country. I have access to a file with info of all >> the rivers. It's a file with the extension .shp, and I was already able to >> open it using the geotools tools. I was able to open the map in the swing >> interface of geotools, and see all the rivers, and also see information of >> each river by clicking it. >> After this, I was able, with a few lines of code, to search info about a >> river by its name: I opened the file, and made a query with a filter >> applied to one of the fields (designation of the river), and it will find >> all the rivers which contain a given string in its designation. >> >> When I wrote this code, I noticed that for each river, there is some >> geometric(?) information about them, a list of coordinates. As I have no >> knowledge about this type of files and its structure, I really don't know >> how to interpret those coordinates, and I really needed some way to do that. >> >> The functionality that I need to implement is, given a pair of >> coordinates (latitude and longitude), check if it belongs to any river in >> the file, and return info about it. I know that it should be possible >> because using the swing interface, and clicking the river, it returns info >> about it, so I think that somehow the program receives coordinates about >> the place I clicked, and searches the file for a river containing those >> coordinates. Am I right? >> >> If so, and if possible, what I needed to know is how to do that... My >> plan was to reverse engineer the code with eclema for eclipse, but I >> couldn't import all the source code to my project, so I didn't succeed, >> that's why I'm contacting you. Probably what I want to do is simple, and a >> few guidelines from someone who is familiarized with the project will >> suffice. My main problem is how to convert latitude and longitude to the >> coordinate system used in the file I have, and also match a pair of >> coordinates to the info in the file (to check if they belong to any river). >> >> If it helps, here is the file I'm working with: http://1drv.ms/1SaccYG >> >> Sorry for bothering you with this, but you're probably my last resource, >> as I've been struggling with this for the last week, with no luck... >> >> Thanks and best regards, >> >> João Norim >> >> >> >> >> ------------------------------------------------------------------------------ >> >> >> _______________________________________________ >> >> GeoTools-GT2-Users mailing list >> >> [email protected] >> >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> >> >> _______________________________________________ >> GeoTools-GT2-Users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> >> > -- > Ben Caradoc-Davies <[email protected]> > Director > Transient Software Limited <http://transient.nz/> > New Zealand > -- Ian Turton
------------------------------------------------------------------------------
_______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
