|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
How can I add a postgis layer in openmapSurely there is a way to get this done???? How can I add a postgis layer in openmap?
|
|
|
Re: How can I add a postgis layer in openmapHello.
One way could be to use JTS to create geometries from WKT and then the code I posted on the "Help with OMGraphics"-thread to convert from JTS to OMGraphic. Another way would be to use the PostGIS jdbc driver and create/find some code to convert their geometry-format to OMGraphic. - Tore. On Sep 1, 2009, at 16:56 , JayDub wrote: > > Surely there is a way to get this done???? How can I add a postgis > layer in > openmap? > -- > View this message in context: http://www.nabble.com/How-can-I-add-a-postgis-layer-in-openmap-tp25241834p25241834.html > Sent from the OpenMap mailing list archive at Nabble.com. > > -- > [To unsubscribe to this list send an email to "majdart@..." > with the following text in the BODY of the message "unsubscribe > openmap-users"] > -- [To unsubscribe to this list send an email to "majdart@..." with the following text in the BODY of the message "unsubscribe openmap-users"] |
|
|
Re: How can I add a postgis layer in openmapI know for fact that a postgis driver was built for OpenMap about 2 or so years ago. Apparently that wasn't patched in? I'd hate to think that I'll have to reinvent the wheel for this to work. I'm about to start a project for which I was depending on this postgis driver for everything to work.
|
|
|
Re: How can I add a postgis layer in openmapMaybe this can help
http://openmap.bbn.com/mailArchives/openmap-users/att-5403/PostGISGeometryLayer.java___size_19066 On 02-09-2009 18:52, JayDub wrote: > I know for fact that a postgis driver was built for OpenMap about 2 or so > years ago. Apparently that wasn't patched in? I'd hate to think that I'll > have to reinvent the wheel for this to work. I'm about to start a project > for which I was depending on this postgis driver for everything to work. > > > Tore Halset wrote: > >> Hello. >> >> One way could be to use JTS to create geometries from WKT and then the >> code I posted on the "Help with OMGraphics"-thread to convert from JTS >> to OMGraphic. Another way would be to use the PostGIS jdbc driver and >> create/find some code to convert their geometry-format to OMGraphic. >> >> - Tore. >> >> On Sep 1, 2009, at 16:56 , JayDub wrote: >> >> >>> Surely there is a way to get this done???? How can I add a postgis >>> layer in >>> openmap? >>> -- >>> View this message in context: >>> http://www.nabble.com/How-can-I-add-a-postgis-layer-in-openmap-tp25241834p25241834.html >>> Sent from the OpenMap mailing list archive at Nabble.com. >>> >>> -- >>> [To unsubscribe to this list send an email to "majdart@..." >>> with the following text in the BODY of the message "unsubscribe >>> openmap-users"] >>> >>> >> -- >> [To unsubscribe to this list send an email to "majdart@..." >> with the following text in the BODY of the message "unsubscribe >> openmap-users"] >> >> >> > -- [To unsubscribe to this list send an email to "majdart@..." with the following text in the BODY of the message "unsubscribe openmap-users"] |
|
|
Re: How can I add a postgis layer in openmapThanks for this... So far I'm getting somewhere it seems.
Had to download the postgis driver and the jdbc driver. Now I get this exception... any ideas? I've put a shp file into the database using shp2pgsql -s 3344 shpfile.shp tablename > file.sql Then pgsql dbname -f file.sql org.postgresql.util.PSQLException: ERROR: Operation on two geometries with different SRIDs at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:353) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:252) at hs.module.map.PostGISGeometryLayer.prepare(PostGISGeometryLayer.java:239) at com.bbn.openmap.layer.policy.StandardRenderPolicy.prepare(StandardRenderPolicy.java:99) at com.bbn.openmap.layer.OMGraphicHandlerLayer$LayerWorker.construct(OMGraphicHandlerLayer.java:695) at com.bbn.openmap.util.SwingWorker$2.run(SwingWorker.java:127)
|
|
|
Re: How can I add a postgis layer in openmapOkay... my mistake...
I needed to use 4326 as the SRID shp2pgsql -s 4326 ... blah blah I have another problem though. Point shows up fine. I have another geom layer that does not show up @ all. Any suggestions? I get no errors.
|
|
|
Re: How can I add a postgis layer in openmapHello.
On 3. sep.. 2009, at 04.10, JayDub wrote: > I have another problem though. Point shows up fine. I have another > geom > layer that does not show up @ all. Any suggestions? I get no errors. Do you have any more details? - Tore. -- [To unsubscribe to this list send an email to "majdart@..." with the following text in the BODY of the message "unsubscribe openmap-users"] |
|
|
Re: How can I add a postgis layer in openmapIt was my mistake again....
Just a word of advice for anyone who tries this. Two tips: 1. Make sure when converting shp files that you use the -s SRID option to set the SRID on the data. This is important. Failure to do this will result an error about "Operation on different SRIDs" 2. If nothing shows up on the map.. try printing out the query and trying it in Postgres. In my case, when I tried the query in postgres I noticed that nothing was returned. Then I noticed that the data I had was in a different projection. I confirmed this with QGIS (VERY useful tool by the way). New Question Has this class ever been optimized though? I notice that when you move the layers on the map... the painting is a tad bit weird and inefficient. Visually you notice the following: 1. It repaints the postgis layer as removed from the map 2. It repaints the postgis layer in the old position 3. It repaints the postgis layer in the new position So what you get is a flash image. So for example... if you pan left, when you let go of the map the others layers and painted... the postgis layer disappears, then right before it is painted in the correct location it is painted in the old location. I hope I can find the code that does that. This is extremely inefficient especially when the SHP file gets large. I tried using a 5MB shp file and the map became VERY unresponsive. I have a project coming up where I'll have to be using lots of large shp files. For each of these shp files, I'll need to query the layers.
|
|
|
Re: How can I add a postgis layer in openmapI'm not sure how much this will help but I'm going to try using PreparedStatement's and see if that helps anything.
Any ideas on how this class may be improved?
|
|
|
BoundaryCrossing iterator orderHi,
I am using the BoundaryCrossing feature of OpenMap to determine the polygons that a path crosses. According to the API the BoundaryCrossing.Collector.compact method is "An important method that cleans up the segment/region BoundaryCrossing order, and also resolves the BoundaryCrossing.in/out settings for regions. Must be called before the crossing iterator is retrieved, but the BoundaryCrossing method does that." The BoundaryCrossing.Collector.getCrossings method calls "compact" before generating the iterator. However, I seem to get strange results. When I run the following program import com.bbn.openmap.geo.*; import java.util.*; public class Test { public static void main(String[] args) { List<GeoRegion> regions = new ArrayList(); GeoRegion.Impl x = new GeoRegion.Impl(new float[]{10, 10, -10, 10, -10, 20, 10, 20, 10, 10}); x.setID("A"); regions.add(x); GeoRegion.Impl y = new GeoRegion.Impl(new float[]{10, 30, -10, 30, -10, 40, 10, 40, 10, 30}); y.setID("B"); regions.add(y); float[] route = {0, 0, 0, 25, 0, 50}; / *****************************/ GeoPath.Impl path = new GeoPath.Impl(route); BoundaryCrossing.Collector bcc = BoundaryCrossing.getCrossings(path, regions); Iterator it = bcc.getCrossings(); while (it.hasNext()) { BoundaryCrossing o = (BoundaryCrossing) it.next(); GeoRegion in = o.getIn(); GeoRegion ou = o.getOut(); System.out.println(o.getGeo()); if (in != null) { System.out.println(" Enter " + in.getID()); } if (ou != null) { System.out.println(" Exit " + ou.getID()); } } } } I get the output Geo[-0.0,29.999999612082494] Enter B Geo[-0.0,9.999999573437877] Enter A Geo[-0.0,19.999999678147237] Exit A Geo[-0.0,40.00000052659251] Exit B The points I understand, but I expected them to appear in order Enter A, Exit A, Enter B, Exit B When I replace the line labelled /*****************/ with float[] route = {0, 50, 0, 25, 0, 0}; i.e. reverse the direction of the path, the output is Geo[0.0,19.999999678147237] Enter A Geo[0.0,9.999999573437877] Exit A Geo[0.0,40.00000052659251] Enter B Geo[0.0,29.999999612082494] Exit B Is my understanding of the order in which the iterator returns crossing points incorrect? If so, is there any way to order the crossings in the sequence they are visited along the direction of the path. Thanks, Paul -- [To unsubscribe to this list send an email to "majdart@..." with the following text in the BODY of the message "unsubscribe openmap-users"] |
|
|
Re: BoundaryCrossing iterator orderHi Paul,
The boundary crossing should be coming out of the iterator in order. That's what I've always seen when using testing with the com.bbn.openmap.layer.test.GeoIntersectionLayer. Have you rendered the regions and intersection points to see if the results make sense? You're not working in cartesian space, and you might see something you didn't expect when the route and regions are rendered. - Don On Sep 11, 2009, at 6:28 AM, Paul Chisholm wrote: > Hi, > > I am using the BoundaryCrossing feature of OpenMap to determine the > polygons that a path crosses. According to the API the > BoundaryCrossing.Collector.compact method is "An important method > that cleans up the segment/region BoundaryCrossing order, and also > resolves the BoundaryCrossing.in/out settings for regions. Must be > called before the crossing iterator is retrieved, but the > BoundaryCrossing method does that." The > BoundaryCrossing.Collector.getCrossings method calls "compact" > before generating the iterator. However, I seem to get strange > results. When I run the following program > > import com.bbn.openmap.geo.*; > import java.util.*; > > public class Test { > public static void main(String[] args) { > List<GeoRegion> regions = new ArrayList(); > GeoRegion.Impl x = new GeoRegion.Impl(new float[]{10, 10, > -10, 10, -10, 20, 10, 20, 10, 10}); > x.setID("A"); > regions.add(x); > GeoRegion.Impl y = new GeoRegion.Impl(new float[]{10, 30, > -10, 30, -10, 40, 10, 40, 10, 30}); > y.setID("B"); > regions.add(y); > float[] route = {0, 0, 0, 25, 0, 50}; / > *****************************/ > GeoPath.Impl path = new GeoPath.Impl(route); > BoundaryCrossing.Collector bcc = BoundaryCrossing.getCrossings > (path, regions); > Iterator it = bcc.getCrossings(); > while (it.hasNext()) { > BoundaryCrossing o = (BoundaryCrossing) it.next(); > GeoRegion in = o.getIn(); > GeoRegion ou = o.getOut(); > System.out.println(o.getGeo()); > if (in != null) { > System.out.println(" Enter " + in.getID()); > } > if (ou != null) { > System.out.println(" Exit " + ou.getID()); > } > } > } > } > > I get the output > > Geo[-0.0,29.999999612082494] > Enter B > Geo[-0.0,9.999999573437877] > Enter A > Geo[-0.0,19.999999678147237] > Exit A > Geo[-0.0,40.00000052659251] > Exit B > > The points I understand, but I expected them to appear in order > Enter A, Exit A, Enter B, Exit B > > When I replace the line labelled > > /*****************/ > > with > > float[] route = {0, 50, 0, 25, 0, 0}; > > i.e. reverse the direction of the path, the output is > > Geo[0.0,19.999999678147237] > Enter A > Geo[0.0,9.999999573437877] > Exit A > Geo[0.0,40.00000052659251] > Enter B > Geo[0.0,29.999999612082494] > Exit B > > Is my understanding of the order in which the iterator returns > crossing points incorrect? If so, is there any way to order the > crossings in the sequence they are visited along the direction of > the path. > > Thanks, > Paul > > -- > [To unsubscribe to this list send an email to "majdart@..." > with the following text in the BODY of the message "unsubscribe > openmap-users"] -- [To unsubscribe to this list send an email to "majdart@..." with the following text in the BODY of the message "unsubscribe openmap-users"] |
|
|
Re: BoundaryCrossing iterator orderDon,
I rendered the regions and path and they display as expected. The crossing points are also as expected, just not in the expected order. All my data is expressed as lat/long decimal degrees. I will try to find some time and trace the execution to see if I can work out what is happening. Paul On 12/09/2009, at 1:54 AM, Don Dietrick wrote: > Hi Paul, > > The boundary crossing should be coming out of the iterator in > order. That's what I've always seen when using testing with the > com.bbn.openmap.layer.test.GeoIntersectionLayer. > > Have you rendered the regions and intersection points to see if the > results make sense? You're not working in cartesian space, and you > might see something you didn't expect when the route and regions are > rendered. > > - Don > > On Sep 11, 2009, at 6:28 AM, Paul Chisholm wrote: > >> Hi, >> >> I am using the BoundaryCrossing feature of OpenMap to determine the >> polygons that a path crosses. According to the API the >> BoundaryCrossing.Collector.compact method is "An important method >> that cleans up the segment/region BoundaryCrossing order, and also >> resolves the BoundaryCrossing.in/out settings for regions. Must be >> called before the crossing iterator is retrieved, but the >> BoundaryCrossing method does that." The >> BoundaryCrossing.Collector.getCrossings method calls "compact" >> before generating the iterator. However, I seem to get strange >> results. When I run the following program >> >> import com.bbn.openmap.geo.*; >> import java.util.*; >> >> public class Test { >> public static void main(String[] args) { >> List<GeoRegion> regions = new ArrayList(); >> GeoRegion.Impl x = new GeoRegion.Impl(new float[]{10, 10, >> -10, 10, -10, 20, 10, 20, 10, 10}); >> x.setID("A"); >> regions.add(x); >> GeoRegion.Impl y = new GeoRegion.Impl(new float[]{10, 30, >> -10, 30, -10, 40, 10, 40, 10, 30}); >> y.setID("B"); >> regions.add(y); >> float[] route = {0, 0, 0, 25, 0, 50}; / >> *****************************/ >> GeoPath.Impl path = new GeoPath.Impl(route); >> BoundaryCrossing.Collector bcc = >> BoundaryCrossing.getCrossings(path, regions); >> Iterator it = bcc.getCrossings(); >> while (it.hasNext()) { >> BoundaryCrossing o = (BoundaryCrossing) it.next(); >> GeoRegion in = o.getIn(); >> GeoRegion ou = o.getOut(); >> System.out.println(o.getGeo()); >> if (in != null) { >> System.out.println(" Enter " + in.getID()); >> } >> if (ou != null) { >> System.out.println(" Exit " + ou.getID()); >> } >> } >> } >> } >> >> I get the output >> >> Geo[-0.0,29.999999612082494] >> Enter B >> Geo[-0.0,9.999999573437877] >> Enter A >> Geo[-0.0,19.999999678147237] >> Exit A >> Geo[-0.0,40.00000052659251] >> Exit B >> >> The points I understand, but I expected them to appear in order >> Enter A, Exit A, Enter B, Exit B >> >> When I replace the line labelled >> >> /*****************/ >> >> with >> >> float[] route = {0, 50, 0, 25, 0, 0}; >> >> i.e. reverse the direction of the path, the output is >> >> Geo[0.0,19.999999678147237] >> Enter A >> Geo[0.0,9.999999573437877] >> Exit A >> Geo[0.0,40.00000052659251] >> Enter B >> Geo[0.0,29.999999612082494] >> Exit B >> >> Is my understanding of the order in which the iterator returns >> crossing points incorrect? If so, is there any way to order the >> crossings in the sequence they are visited along the direction of >> the path. >> >> Thanks, >> Paul >> >> -- >> [To unsubscribe to this list send an email to "majdart@..." >> with the following text in the BODY of the message "unsubscribe >> openmap-users"] > > -- [To unsubscribe to this list send an email to "majdart@..." with the following text in the BODY of the message "unsubscribe openmap-users"] |
| Free embeddable forum powered by Nabble | Forum Help |