[Geotools-gt2-users] Issue in 2.6.4 FeatureTypes.getAncestors(...)
Hi GeoTools team, I would have directly put that on the JIRA, but am not sure where to register: In GeoTools 2.6.4, there is an issue in FeatureTypes.getAncestors(...) that will in some cases, specifically when a FeatureType's supertype is not a FeatureType, but a ComplexType (as it is the case for the AbstractFeatureType instance, for example, that GeoTools creates by default) make the function loop indefinitely. This was resolved in 2.5.8 already. We'd suggest the following patch to the function: public static ListFeatureType getAncestors(FeatureType featureType) { ListFeatureType ancestors = new ArrayListFeatureType(); AttributeType type = featureType; while (type.getSuper() != null) { if (type.getSuper() instanceof FeatureType) { FeatureType superType = (FeatureType) featureType.getSuper(); ancestors.add(superType); } type = type.getSuper(); } return ancestors; } Kind regards, Thorsten -- Thorsten Reitz Fraunhofer-Institut für Graphische Datenverarbeitung IGD Fraunhoferstr. 5 | 64283 Darmstadt | Germany thorsten.re...@igd.fraunhofer.de | www.igd.fraunhofer.de -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Issue in 2.6.4 FeatureTypes.getAncestors(...)
Thorsten, you are quite right: the present implementation will not terminate if a FeatureType has a getSuper() that is not also a FeatureType. I once fixed another bug in this method and never noticed this problem. *facepalm* The only reason it works at the moment is that, as far as i can tell, existing use in GeoTools constructs FeatureType hierarchies that terminate at a FeatureType Feature which has getSuper() null. But in general this need not always be the case. We need a bit more clarification on what it should do. Jody, should this method terminate at the first non-FeatureType ancestor, or is it possible to have more FeatureType instances further up in the hierarchy? I am more inclined to break than continue the while loop. Thorsten: (1) How do you create your FeatureType? (And can we have a code snippet of this for testing?) (2) What do you expect getAncestors to return? (It can only return FeatureTypes.) Kind regards, Ben. On 16/06/10 15:52, Thorsten Reitz wrote: Hi GeoTools team, I would have directly put that on the JIRA, but am not sure where to register: In GeoTools 2.6.4, there is an issue in FeatureTypes.getAncestors(...) that will in some cases, specifically when a FeatureType's supertype is not a FeatureType, but a ComplexType (as it is the case for the AbstractFeatureType instance, for example, that GeoTools creates by default) make the function loop indefinitely. This was resolved in 2.5.8 already. We'd suggest the following patch to the function: public static ListFeatureType getAncestors(FeatureType featureType) { ListFeatureType ancestors = new ArrayListFeatureType(); AttributeType type = featureType; while (type.getSuper() != null) { if (type.getSuper() instanceof FeatureType) { FeatureType superType = (FeatureType) featureType.getSuper(); ancestors.add(superType); } type = type.getSuper(); } return ancestors; } Kind regards, Thorsten -- Ben Caradoc-Davies ben.caradoc-dav...@csiro.au Software Engineering Team Leader CSIRO Earth Science and Resource Engineering Australian Resources Research Centre -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Issue in 2.6.4 FeatureTypes.getAncestors(...)
Hi Ben, thanks for the quick reply. With respect to your questions: (1) How do you create your FeatureType? (And can we have a code snippet of this for testing?) We have a custom GML AppSchema reader that you can have a detailed look at here: http://community.esdi-humboldt.eu/repositories/browse/hale/eu.esdihumboldt.hale.schemaprovider The main class is this one: http://community.esdi-humboldt.eu/repositories/entry/hale/eu.esdihumboldt.hale.schemaprovider/src/eu/esdihumboldt/hale/schemaprovider/provider/ApacheSchemaProvider.java The FeatureTypes themselves are created here: http://community.esdi-humboldt.eu/repositories/entry/hale/eu.esdihumboldt.hale.schemaprovider/src/eu/esdihumboldt/hale/schemaprovider/model/TypeDefinition.java (check the method called createFeatureType). And sorry for our FeatureTypeBuilder's name ;). (2) What do you expect getAncestors to return? (It can only return FeatureTypes.) The getAncestors method is not invoked directly by our code, but rather within the following stack: FeatureTypes.getAncestors(FeatureType) line: 398 FeatureTypes.isDecendedFrom(FeatureType, URI, String) line: 434 StreamingRenderer.isFeatureTypeStyleActive(SimpleFeatureType, FeatureTypeStyle) line: 1553 StreamingRenderer.createLiteFeatureTypeStyles(FeatureTypeStyle[], SimpleFeatureType, Graphics2D) line: 1518 StreamingRenderer.processStylers(Graphics2D, MapLayer, AffineTransform, CoordinateReferenceSystem, Envelope, Rectangle, String) line: 1759 StreamingRenderer.paint(Graphics2D, Rectangle, ReferencedEnvelope, AffineTransform) line: 699 StreamingRenderer.paint(Graphics2D, Rectangle, ReferencedEnvelope) line: 524 FeatureTileRenderer.getTile(TileConstraints, int, int, int) line: 132 This last class is the first one of our code. HTH kind regards, Thorsten -- Thorsten Reitz Fraunhofer-Institut für Graphische Datenverarbeitung IGD Fraunhoferstr. 5 | 64283 Darmstadt | Germany thorsten.re...@igd.fraunhofer.de | www.igd.fraunhofer.de -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Issue in 2.6.4 FeatureTypes.getAncestors(...)
On 16/06/10 16:40, Thorsten Reitz wrote: The FeatureTypes themselves are created here: http://community.esdi-humboldt.eu/repositories/entry/hale/eu.esdihumboldt.hale.schemaprovider/src/eu/esdihumboldt/hale/schemaprovider/model/TypeDefinition.java (check the method called createFeatureType). And sorry for our FeatureTypeBuilder's name ;). This has to be reported to the list: SimpleFeatureTypeBuilderThatHasNoSillySuperTypeRestriction Excellent! -- Ben Caradoc-Davies ben.caradoc-dav...@csiro.au Software Engineering Team Leader CSIRO Earth Science and Resource Engineering Australian Resources Research Centre -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
[Geotools-gt2-users] Splitting LineStrings at their intersection for DijkstraShortestPathFinder
Hi Dear All. I'm quite new in Geotools area and hope somebody of you will point me a proper direction. I'm developing a server side Java method which should estimate shortest vehicle path between any 2 points placed within 1 country. Data is given from a Denmark OSM highway shapefile downloaded from public CloudsMade server. In order to optimize process I'm selecting from database features (lines) placed within a rectangle between start and end points. Usually it is 1500- 10 000 of LineString objects. From geotools-gt2-users mail archive I've learnt that lines MUST be intersected each other otherwise DijkstraShortestPathFinder will not return any path between given source and destination nodes for a Directed graph built from a lines array. There is mailing initiated by Cris ( http://www.mail-archive.com/geotools-gt2-users@lists.sourceforge.net/msg04520.html) regarding splitlines function. I'm using last function version published by Cris Jan 2008 (please find it at the end of the mail), but after days of debug found it over optimized. Usually it is only double number of lines from input VectorLineString. For 1500 lines it built less then 3000 of intersected lines. As an Impact DijkstraShortestPathFinder can't find a path for the most source/destination points distanced more then 40 Kms each other, because Graph is not well connected. Could somebody point me, please, on the source where I could find good intersection method for VectorLineString using Quadtree? How I can check that Graph is well partitioned and most of nodes are connected each other? Thank you in advance for your reply. I'm split lines with a following function: ** *private VectorLineString splitLines(VectorLineString lines) { Quadtree index = new Quadtree(); // Fill Spatial Index for (int i = 0; i lines.size(); ++i) { LineString l = (LineString) lines.get(i); index.insert(l.getEnvelopeInternal(), l); } int imax = lines.size(); System.out.println(Added + String.valueOf(imax) + new lines); for (int i = 0; i imax; ++i) { LineString l1 = (LineString) lines.get(i); VectorLineString l1_sub = new VectorLineString(); List close = index.query(l1.getEnvelopeInternal()); for (int j = 0; j close.size(); ++j) { LineString l2 = (LineString) close.get(j); Geometry gc = l1.intersection(l2); if (gc.getNumGeometries() 0) { // Intersection try { Point p = (Point) gc.getGeometryN(0); if (l2.getStartPoint() != p l2.getEndPoint() != p) { Coordinate[] c = new Coordinate[]{(l2.getStartPoint()).getCoordinate(), p.getCoordinate()}; LineString l2a = new LineString(new CoordinateArraySequence(c), new GeometryFactory()); c = new Coordinate[]{p.getCoordinate(), (l2.getEndPoint()).getCoordinate()}; LineString l2b = new LineString(new CoordinateArraySequence(c), new GeometryFactory()); // Update spatial index index.remove(l2.getEnvelopeInternal(), l2); index.insert(l2a.getEnvelopeInternal(), l2a); index.insert(l2b.getEnvelopeInternal(), l2b); } if (l1.getStartPoint() != p l1.getEndPoint() != p) { if (l1_sub.size() == 0) { Coordinate[] c = new Coordinate[]{(l1.getStartPoint()).getCoordinate(), p.getCoordinate()}; LineString l1a = new LineString(new CoordinateArraySequence(c), new GeometryFactory()); l1_sub.add(l1a); c = new Coordinate[]{p.getCoordinate(), (l1.getEndPoint()).getCoordinate()}; LineString l1b = new LineString(new CoordinateArraySequence(c), new GeometryFactory()); l1_sub.add(l1b); } else { int k = 0; LineString l1part; do { l1part = (LineString) l1_sub.get(k); if (l1.intersection(l2).getNumGeometries() 0) { break; } ++k; }while (k l1_sub.size()); l1_sub.remove(l1part); Coordinate[] c = new Coordinate[]{(l1part.getStartPoint()).getCoordinate(), p.getCoordinate()}; LineString l1a = new LineString(new CoordinateArraySequence(c), new GeometryFactory());
[Geotools-gt2-users] Zoom changes unexpectedly
Hello everyone, I am developing GIS application using Eclipse RCP and geotools. Specifically, I use geotools JMapPane via SWT_AWT bridge. What I run into is the following zoom problem: it changes to full extent sometimes. It can be easily reproduced this way: 0) Make an RCP application. 1) make a org.eclipse.ui.part.EditorPart. 2) put JMapPane there using a SWT_AWT bridge 3) add shapefile layer to it 4) zoom to some part of the shapefile layer 5) maximize your EditorPart. 6) It is zoomed to full extent though it was not asked to. I think there are some of you who fight geotools and RCP stuff, need your help! Thanks in advance, Sergey -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
[Geotools-gt2-users] Intersection of PostGIS view and shape file
hey guys, I wrote some code but unfortunately it does not work and I do not know why. I want to read in a featureCollection from a PostGIS database and a shape file given by the user. These two feature collections are going to be intersect with each other. I want to loop the one from the PostGIS and get all features from shape file lying in feature from PostGIS. I want to use the attributes from the shape file and add attributes from PostGIS. features that are not full in the other feature are going to be intersected. was this understandable? I need a little help. Here is my code: public File intersect(GISViewer viewer, FeatureCollectionSimpleFeatureType, SimpleFeature featureCollection) throws Exception { // initialize feature collection featColl_adminUnit = featureCollection; shapefile = new Shapefile(); crs_INSPIRE = new CoordReferSyst(); // create new shape file and reproject old one file = shapefile.reprojectToShapefile(viewer); //works fine store = FileDataStoreFinder.getDataStore(file); featSource_input = store.getFeatureSource(); featColl_input = featSource_input.getFeatures(); // create a new shape file with a slight modified schema fileNew = new File(TempFile.shp); factory = new ShapefileDataStoreFactory(); create = new HashMapString, Serializable(); create.put(url, fileNew.toURI().toURL()); create.put(create spatial index, Boolean.TRUE); newDataStore = factory.createNewDataStore(create); schema = featSource_input.getSchema(); featureType = SimpleFeatureTypeBuilder.retype(schema, crs_INSPIRE.crs_ETRS89_LAEA()); newDataStore.createSchema(featureType); // carefully open an iterator and writer to process the results transaction = new DefaultTransaction(Convert); writer = newDataStore.getFeatureWriterAppend(featureType.getTypeName(), transaction); // initialize feature iterator iterator_adminUnit = featColl_adminUnit.features(); iterator_input = featColl_input.features(); try { while(iterator_adminUnit.hasNext()){ feature_adminUnit = iterator_adminUnit.next(); boundingBox = feature_adminUnit.getBounds(); geometryColumnName = feature_adminUnit.getDefaultGeometryProperty().getName(); cqlExpression = BBOX( + geometryColumnName + , + boundingBox.getMinX() + , + boundingBox.getMinY() + , + boundingBox.getMaxX() + , + boundingBox.getMaxY() + ); try { filter = CQL.toFilter(cqlExpression); collectionBoundingBox = featSource_input.getFeatures(filter); featureIterator = collectionBoundingBox.features(); } catch (CQLException e1) { System.out.printf(Unable to create CQL : {}, Reason: {}, cqlExpression , e1); continue; } while(featureIterator.hasNext()) { feature = featureIterator.next(); java.util.List attributes = new ArrayList(); attributes.add(feature.getAttributes()); attributes.add(feature_adminUnit.getAttributes()); copy.setAttributes(attributes); Geometry geometry1 = (Geometry) feature.getDefaultGeometry(); Geometry geometry2 = (Geometry) feature_adminUnit.getDefaultGeometry(); if (geometry2.contains(geometry1)){ copy = writer.next(); copy.setDefaultGeometry(geometry1); writer.write(); } if (geometry2.intersects(geometry1)){ copy = writer.next(); geometry3 = geometry2.intersection(geometry1);
Re: [Geotools-gt2-users] support WMS-C
Hello, I have a problem of quality from my display with WMCS. I test with Udig program and the bad quality is here too. I let several pictures from Udif, my program and the picture saved by the method ONDISK to check the differences between the pictures. I don't know why the quality is like that. I thought that the pictures weren't display in this real size. But after test I thing that is not the problem. I test with antialiased and not but there aren't difference. Every picture is 256*256 pixel sized. And the format is png in the WMSC server. http://osgeo-org.1803224.n2.nabble.com/file/n5186557/monProg.jpg http://osgeo-org.1803224.n2.nabble.com/file/n5186557/Udig.png http://osgeo-org.1803224.n2.nabble.com/file/n5186557/30_19.png http://osgeo-org.1803224.n2.nabble.com/file/n5186557/30_20.png http://osgeo-org.1803224.n2.nabble.com/file/n5186557/31_19.png http://osgeo-org.1803224.n2.nabble.com/file/n5186557/31_20.png Thanks, Didier CREST -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/support-WMS-C-tp5008579p5186557.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Zoom changes unexpectedly
On Wed, Jun 16, 2010 at 9:27 AM, LSA l...@ngs.ru wrote: Hello everyone, I am developing GIS application using Eclipse RCP and geotools. Specifically, I use geotools JMapPane via SWT_AWT bridge. What I run into is the following zoom problem: it changes to full extent sometimes. It can be easily reproduced this way: 0) Make an RCP application. 1) make a org.eclipse.ui.part.EditorPart. 2) put JMapPane there using a SWT_AWT bridge 3) add shapefile layer to it 4) zoom to some part of the shapefile layer 5) maximize your EditorPart. 6) It is zoomed to full extent though it was not asked to. I think that is a feature not a bug - When I originally wrote the mappane code I had to make a choice of what happened when the pane resized and that was easiest. At the time of resize the aspect ratio has changed, all the dimensions have changed so I decided to throw everything away and zoom to full extent. Feel free to change the code to do something else if that is what you need. Ian -- Ian Turton -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Splitting LineStrings at their intersection for DijkstraShortestPathFinder
Oleg Demchenko wrote: Data is given from a Denmark OSM highway shapefile downloaded from public CloudsMade server. In order to optimize process I'm selecting from database If you use the OSM data, why don't you download their nodes and ways directly instead of using the generated shapefile and try to reconstruct the graph based on intersections? You'll end up as Geisterfahrer on the Autobahn ;-) Jan -- From address is valid until 01.06.2011 -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
[Geotools-gt2-users] MapLayer's and GridCoverage2D's
Hi, I'm pretty new to geotools, so excuse me if this is a really simple question, but I have searched everywhere and I can't find an answer: How can I determine if a MapLayer object contains a GridCoverage object, and if it does contain a GridCoverage, how can I extract it out? I am adding a lot of image layers to a MapContext using the addLayer(AbstractGridCoverage2DReader gridCoverage, Style style) method from the DefaultMapContext class. I am also adding Shapefiles using another some of the other overloaded addLayer methods. When I go back to manipulate a layer in which I inserted an image, I am having trouble detecting that it is a GridCoverage2D object that is within the MapLayer object. I can detect if they are shapefiles just fine. Is this something right in front of me that I can't see? Thanks in advance! S Dille -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/MapLayer-s-and-GridCoverage2D-s-tp5187306p5187306.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
[Geotools-gt2-users] DataStore
Hi folks, I'm new in GIS applications and I want to implement one datastore that meets some requirements. For this, I'm implementing a extension datastore. So, a need some help with documentation and experience. Do you give me some help? Thanks a lot. -- Atenciosamente, Egio Arruda Junior Bacharel em Ciências da Computação - UFG -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] [Geoserver-devel] DataStore
Hi Erio: You will want to visit the GeoTools project; go through a couple of the tutorials that show how feature types and features are created. - http://docs.geotools.org/stable/userguide/examples/csv2shp.html - http://geotoolsnews.blogspot.com/2009/11/foss4g-geotools-tutorials.html (longer form) Finally you will want to look at this tutorial (which is outdated but gets the general idea of the tasks that need to be performed): - http://docs.codehaus.org/display/GEOTDOC/DataStore+Developers+Guide Jody On 17/06/2010, at 4:08 AM, Egio Arruda wrote: Hi folks, I'm new in GIS applications and I want to implement one datastore that meets some requirements. For this, I'm implementing a extension datastore. So, a need some help with documentation and experience. Do you give me some help? Thanks a lot. -- Atenciosamente, Egio Arruda Junior Bacharel em Ciências da Computação - UFG -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ Geoserver-devel mailing list geoserver-de...@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-devel -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] support WMS-C
This one is easy to explain but hard to fix. The individual images are indeed correct; I suspect that the map context you are rendering into: - does not match exactly the crs used by the tile set - we are rendering as grid coverages which can resample the image between projections - does not match exactly the zoom level of the tileset (this is why applications like open layers have fixed zoom levels) In uDig we changed our zoomIn/zoomOut buttons to respect the zoom levels of the data for these cases; and had to make a seperate pan tool that respected the resolution (usually if you just pan your bounding box you will gradually change scale; and thus the screen will not match exactly the resolution of the tileset). Jody On 16/06/2010, at 11:48 PM, Toshy wrote: Hello, I have a problem of quality from my display with WMCS. I test with Udig program and the bad quality is here too. I let several pictures from Udif, my program and the picture saved by the method ONDISK to check the differences between the pictures. I don't know why the quality is like that. I thought that the pictures weren't display in this real size. But after test I thing that is not the problem. I test with antialiased and not but there aren't difference. Every picture is 256*256 pixel sized. And the format is png in the WMSC server. http://osgeo-org.1803224.n2.nabble.com/file/n5186557/monProg.jpg http://osgeo-org.1803224.n2.nabble.com/file/n5186557/Udig.png http://osgeo-org.1803224.n2.nabble.com/file/n5186557/30_19.png http://osgeo-org.1803224.n2.nabble.com/file/n5186557/30_20.png http://osgeo-org.1803224.n2.nabble.com/file/n5186557/31_19.png http://osgeo-org.1803224.n2.nabble.com/file/n5186557/31_20.png Thanks, Didier CREST -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/support-WMS-C-tp5008579p5186557.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Issue in 2.6.4 FeatureTypes.getAncestors(...)
On 16/06/2010, at 6:26 PM, Ben Caradoc-Davies wrote: Thorsten, you are quite right: the present implementation will not terminate if a FeatureType has a getSuper() that is not also a FeatureType. I once fixed another bug in this method and never noticed this problem. *facepalm* The only reason it works at the moment is that, as far as i can tell, existing use in GeoTools constructs FeatureType hierarchies that terminate at a FeatureType Feature which has getSuper() null. But in general this need not always be the case. We need a bit more clarification on what it should do. Jody, should this method terminate at the first non-FeatureType ancestor, or is it possible to have more FeatureType instances further up in the hierarchy? I am more inclined to break than continue the while loop. Do what is needed; and update the javadocs accordingly :-) Do we have a jira reported yet... Jody -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Splitting LineStrings at their intersection for DijkstraShortestPathFinder
There is also a seperate builder that builds a graph based on the line segmenets; perhaps you could combine the two ideas in your own graph builder and contribute the result back/ Jody On 16/06/2010, at 8:08 PM, Oleg Demchenko wrote: Hi Dear All. I'm quite new in Geotools area and hope somebody of you will point me a proper direction. I'm developing a server side Java method which should estimate shortest vehicle path between any 2 points placed within 1 country. Data is given from a Denmark OSM highway shapefile downloaded from public CloudsMade server. In order to optimize process I'm selecting from database features (lines) placed within a rectangle between start and end points. Usually it is 1500- 10 000 of LineString objects. From geotools-gt2-users mail archive I've learnt that lines MUST be intersected each other otherwise DijkstraShortestPathFinder will not return any path between given source and destination nodes for a Directed graph built from a lines array. There is mailing initiated by Cris (http://www.mail-archive.com/geotools-gt2-users@lists.sourceforge.net/msg04520.html) regarding splitlines function. I'm using last function version published by Cris Jan 2008 (please find it at the end of the mail), but after days of debug found it over optimized. Usually it is only double number of lines from input VectorLineString. For 1500 lines it built less then 3000 of intersected lines. As an Impact DijkstraShortestPathFinder can't find a path for the most source/destination points distanced more then 40 Kms each other, because Graph is not well connected. Could somebody point me, please, on the source where I could find good intersection method for VectorLineString using Quadtree? How I can check that Graph is well partitioned and most of nodes are connected each other? Thank you in advance for your reply. I'm split lines with a following function: private VectorLineString splitLines(VectorLineString lines) { Quadtree index = new Quadtree(); // Fill Spatial Index for (int i = 0; i lines.size(); ++i) { LineString l = (LineString) lines.get(i); index.insert(l.getEnvelopeInternal(), l); } int imax = lines.size(); System.out.println(Added + String.valueOf(imax) + new lines); for (int i = 0; i imax; ++i) { LineString l1 = (LineString) lines.get(i); VectorLineString l1_sub = new VectorLineString(); List close = index.query(l1.getEnvelopeInternal()); for (int j = 0; j close.size(); ++j) { LineString l2 = (LineString) close.get(j); Geometry gc = l1.intersection(l2); if (gc.getNumGeometries() 0) { // Intersection try { Point p = (Point) gc.getGeometryN(0); if (l2.getStartPoint() != p l2.getEndPoint() != p) { Coordinate[] c = new Coordinate[]{(l2.getStartPoint()).getCoordinate(), p.getCoordinate()}; LineString l2a = new LineString(new CoordinateArraySequence(c), new GeometryFactory()); c = new Coordinate[]{p.getCoordinate(), (l2.getEndPoint()).getCoordinate()}; LineString l2b = new LineString(new CoordinateArraySequence(c), new GeometryFactory()); // Update spatial index index.remove(l2.getEnvelopeInternal(), l2); index.insert(l2a.getEnvelopeInternal(), l2a); index.insert(l2b.getEnvelopeInternal(), l2b); } if (l1.getStartPoint() != p l1.getEndPoint() != p) { if (l1_sub.size() == 0) { Coordinate[] c = new Coordinate[]{(l1.getStartPoint()).getCoordinate(), p.getCoordinate()}; LineString l1a = new LineString(new CoordinateArraySequence(c), new GeometryFactory()); l1_sub.add(l1a); c = new Coordinate[]{p.getCoordinate(), (l1.getEndPoint()).getCoordinate()}; LineString l1b = new LineString(new CoordinateArraySequence(c), new GeometryFactory()); l1_sub.add(l1b); } else { int k = 0; LineString l1part; do { l1part = (LineString) l1_sub.get(k); if (l1.intersection(l2).getNumGeometries() 0) { break; }
Re: [Geotools-gt2-users] MapLayer's and GridCoverage2D's
The answer is actually the subject of the work I did last week on geotools trunk (MapContext Refactor) :-) So on 2.7-SNAPSHOT you can perform an: - layer instanceof GridCoverageLayer (loaded into memory) - layer instanceof GridReaderLayer (direct access to disk) Other then that I did learn what happens on 2.6.x - and the answer is that the gridcoverage/gridreader is packaged up as a feature! There is a method: FeatureUtilities.wrapGridCoverage(coverage) That creates a feature using the following feature type: SimpleFeatureTypeBuilder ftb = new SimpleFeatureTypeBuilder(getTypeFactory()); ftb.setName(GridCoverage); ftb.add(geom, Polygon.class, sourceCRS); ftb.add(grid, GridCoverage.class); SimpleFeatureType schema = ftb.buildFeatureType(); Perhaps you could test for this feature type to detect grid coverage layersin 2.6.x? On 17/06/2010, at 2:33 AM, S Dille wrote: Hi, I'm pretty new to geotools, so excuse me if this is a really simple question, but I have searched everywhere and I can't find an answer: How can I determine if a MapLayer object contains a GridCoverage object, and if it does contain a GridCoverage, how can I extract it out? I am adding a lot of image layers to a MapContext using the addLayer(AbstractGridCoverage2DReader gridCoverage, Style style) method from the DefaultMapContext class. I am also adding Shapefiles using another some of the other overloaded addLayer methods. When I go back to manipulate a layer in which I inserted an image, I am having trouble detecting that it is a GridCoverage2D object that is within the MapLayer object. I can detect if they are shapefiles just fine. Is this something right in front of me that I can't see? Thanks in advance! S Dille -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/MapLayer-s-and-GridCoverage2D-s-tp5187306p5187306.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Issue in 2.6.4 FeatureTypes.getAncestors(...)
On 17/06/10 08:06, Jody Garnett wrote: Jody, should this method terminate at the first non-FeatureType ancestor, or is it possible to have more FeatureType instances further up in the hierarchy? I am more inclined to break than continue the while loop. Do what is needed; and update the javadocs accordingly :-) Do we have a jira reported yet... http://jira.codehaus.org/browse/GEOT-3143 Now assigned to Jody for review. The patch stops at the first non-FeatureType; the styler is only interested in feature types. -- Ben Caradoc-Davies ben.caradoc-dav...@csiro.au Software Engineering Team Leader CSIRO Earth Science and Resource Engineering Australian Resources Research Centre -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
Re: [Geotools-gt2-users] Longitude Latitude to East North Up
Hi Duane, I'm copying your message and code (below) to the list. Your fear of Jody was obviously too inhibiting... Andrea, what would be an appropriate way to package Duane's ENU coordinate code for the referencing module ? Michael On 16 June 2010 23:52, Duane Zamrok zam...@cubrc.org wrote: Quite right about that whole Australia thing making it hard to link up. I enjoy a proper (GMT-5) here on the US East coast, and am likely logging on as you get ready to call it a night. Since you don't seem to think Jody will execute me for posting on the wrong userlist, here goes! The code I've attached at the bottom will convert from WGS84 to ENU. It requires an origin for your ENU plane, and a coordinate that you want transformed. That said, I can't help but think that the PROPER way to do this would be to create a new CoordinateReferenceSystem and then define the transforms from WGS84 and ECEF to that system. I'm not very good with GIS/OGC/Geotools so I'm not sure if that would be a DerivedCRS or a ProjectedCRS. For that matter, there are a lot of abstract CRS implementations and interfaces, but I'm nowhere near good enough with them to choose correctly. Hopefully the code will be enough for now. However, if you guys want to point me in the right direction, then it's possible to convince me to expand upon this. Cheers! -Duane /*** * Converts a {...@link DefaultGeographicCRS#WGS84} longitude latitude position into an ENU position whose origin is provided * * @param origin * the origin of your ENU plane. This is a {...@link DirectPosition} object whose {...@link CoordinateReferenceSystem} is * �...@link DefaultGeographicCRS#WGS84} * @param latLong * this is the point whose ENU position you want to compute. This should be a {...@link DirectPosition} object whose * �...@link CoordinateReferenceSystem} is {...@link DefaultGeographicCRS#WGS84} * * @return a {...@link DirectPosition} whose {...@link CoordinateReferenceSystem} is null (since I can't find a good ENU CRS) * @throws FactoryException * This should not happen, but is warranted by * {...@link CRS#findMathTransform(CoordinateReferenceSystem, CoordinateReferenceSystem)} * @throws TransformException * This should not happen but is warranted by {...@link MathTransform#transform(DirectPosition, DirectPosition)}. * Note, the reason it should not happen is because there is already a predefined path between WGS84 and ECEF * @throws MismatchedDimensionException * This should not happen but is warranted by {...@link MathTransform#transform(DirectPosition, DirectPosition)}. * Note: It should not happen because if your parameters are actually WGS84 then the dimensions will all be * proper. */ public DirectPosition toENU(DirectPosition origin, DirectPosition latLong) throws FactoryException, MismatchedDimensionException, TransformException { // This has the potential to throw an exception, but never should. // By default there is a predefined transform path between WGS84 and ECEF MathTransform ecefTransform = CRS.findMathTransform(DefaultGeographicCRS.WGS84, DefaultGeocentricCRS.CARTESIAN); DirectPosition ecefOrigin = ecefTransform.transform(origin, null); DirectPosition ecefLatLong = ecefTransform.transform(latLong, null); double deltaX = ecefLatLong.getOrdinate(0) - ecefOrigin.getOrdinate(0); double deltaY = ecefLatLong.getOrdinate(1) - ecefOrigin.getOrdinate(1); double deltaZ = ecefLatLong.getOrdinate(2) - ecefOrigin.getOrdinate(2); // Get the sin/cos information for the origin double sinLat = Math.sin(origin.getOrdinate(1)); // sin(latitude) double cosLat = Math.cos(origin.getOrdinate(1)); // cos(latitude) double sinLong = Math.sin(origin.getOrdinate(0)); // sin(longitude) double cosLong = Math.cos(origin.getOrdinate(0)); // cos(longitude) // Transform the ECEF double x = (deltaY * cosLong) - (deltaX * sinLong); double y = (deltaZ * cosLat) - (deltaX * sinLat * cosLong) - (deltaY * sinLat * sinLong); double z = (deltaX * cosLat * cosLong) + (deltaY * cosLat * sinLong) + (deltaZ * sinLat); // Return a result return new GeneralDirectPosition(x, y, z); } -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users