GeoTools
  1. GeoTools
  2. GEOT-2995

Problems displaying shapefile and WMS layer together

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: 2.6.2
    • Fix Version/s: 2.6.3, 2.7-M0
    • Component/s: swing
    • Labels:
      None

      Description

      Reported by Tawan on the user list and confirmed by me. Trying to render the coutries shapefile over a WMS layer using JMapFrame provokes this:

      Mar 17, 2010 3:35:13 PM org.geotools.renderer.lite.StreamingRenderer renderRaster
      WARNING: http://wms.jpl.nasa.gov/exception_1_1_1.dtd%20
      java.io.FileNotFoundException: http://wms.jpl.nasa.gov/exception_1_1_1.dtd%20
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1185)
      at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
      at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
      at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
      at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
      at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)
      at org.geotools.data.ows.ServiceExceptionParser.parse(ServiceExceptionParser.java:53)
      at org.geotools.data.ows.Response.parseException(Response.java:76)
      at org.geotools.data.ows.Response.<init>(Response.java:51)
      at org.geotools.data.wms.response.GetMapResponse.<init>(GetMapResponse.java:42)
      at org.geotools.data.wms.WMS1_0_0$GetMapRequest.createResponse(WMS1_0_0.java:288)
      at org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:427)
      at org.geotools.data.wms.WebMapServer.issueRequest(WebMapServer.java:408)
      at org.geotools.map.WMSMapLayer$WMSCoverageReader.getMap(WMSMapLayer.java:310)
      at org.geotools.map.WMSMapLayer$WMSCoverageReader.read(WMSMapLayer.java:289)
      at org.geotools.renderer.lite.StreamingRenderer.renderRaster(StreamingRenderer.java:2170)
      at org.geotools.renderer.lite.StreamingRenderer.processSymbolizers(StreamingRenderer.java:2046)
      at org.geotools.renderer.lite.StreamingRenderer.process(StreamingRenderer.java:1987)
      at org.geotools.renderer.lite.StreamingRenderer.drawOptimized(StreamingRenderer.java:1879)
      at org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1792)
      at org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:699)
      at org.geotools.swing.RenderingExecutor$Task.call(RenderingExecutor.java:148)
      at org.geotools.swing.RenderingExecutor$Task.call(RenderingExecutor.java:104)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
      at java.util.concurrent.FutureTask.run(FutureTask.java:123)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
      at java.lang.Thread.run(Thread.java:613)

        Activity

        Hide
        Andrea Aime added a comment -
        To me it just looks like the WMS server is throwing an exception. Does it work stand alone? Does mixing the two layer force a reprojection?
        Show
        Andrea Aime added a comment - To me it just looks like the WMS server is throwing an exception. Does it work stand alone? Does mixing the two layer force a reprojection?
        Hide
        Michael Bedward added a comment -
        The layer displays fine on its own but every time I add the shapefile runs into the same problem. I've been using the 'WMS global mosaic, not pan sharpened' layer from JPL + countries shapefile from Refractions sample data.

        Tawan's post stated that both his WMS layer and shapefile were were in WGS84.

        It's not some dreaded concurrency issue is it ? Reason I ask is that the layer takes a while to render when on its own but the exception is thrown almost immediately when it's with the shapefile.
        Show
        Michael Bedward added a comment - The layer displays fine on its own but every time I add the shapefile runs into the same problem. I've been using the 'WMS global mosaic, not pan sharpened' layer from JPL + countries shapefile from Refractions sample data. Tawan's post stated that both his WMS layer and shapefile were were in WGS84. It's not some dreaded concurrency issue is it ? Reason I ask is that the layer takes a while to render when on its own but the exception is thrown almost immediately when it's with the shapefile.
        Hide
        Andrea Aime added a comment -
        I looked at the sample code, however the JPL WMS always returns 403 from here. I guess Italy has been blacklisted by NASA? I get a 403 no matter what, even with the stand alone example
        Show
        Andrea Aime added a comment - I looked at the sample code, however the JPL WMS always returns 403 from here. I guess Italy has been blacklisted by NASA? I get a 403 no matter what, even with the stand alone example
        Hide
        Andrea Aime added a comment -
        Ok, tried with a local GeoServer and I think I know what's going on: axis flipping.

        The example does not set a particular axis order and by default GeoTools uses lat/lon. The shapefile has its own .prj that probably explicitly states lon/lat, the wms is coming out with a lat/lon bbox and I guess there is some issue dealing with the reprojection, though not sure were, that I have to investigate.

        However, if the example does like uDig or GeoServer and forces the lon/lat order everything works fine. You can either use:
        System.setProperty("org.geotools.referencing.forceXY", "true");
        or
        Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);

        I know the latter does not fully work in some cases, however the first is annoying as apps are not supposed to set their own system properties (though GeoServer does exactly that since it's the only one that works in all cases).
        Show
        Andrea Aime added a comment - Ok, tried with a local GeoServer and I think I know what's going on: axis flipping. The example does not set a particular axis order and by default GeoTools uses lat/lon. The shapefile has its own .prj that probably explicitly states lon/lat, the wms is coming out with a lat/lon bbox and I guess there is some issue dealing with the reprojection, though not sure were, that I have to investigate. However, if the example does like uDig or GeoServer and forces the lon/lat order everything works fine. You can either use: System.setProperty("org.geotools.referencing.forceXY", "true"); or Hints.putSystemDefault(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); I know the latter does not fully work in some cases, however the first is annoying as apps are not supposed to set their own system properties (though GeoServer does exactly that since it's the only one that works in all cases).
        Hide
        Andrea Aime added a comment -
        Here are the screenshots of what I see with and without the flags
        Show
        Andrea Aime added a comment - Here are the screenshots of what I see with and without the flags
        Hide
        Michael Bedward added a comment -
        Excellent - thanks Andrea
        Show
        Michael Bedward added a comment - Excellent - thanks Andrea

          People

          • Assignee:
            Michael Bedward
            Reporter:
            Michael Bedward
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: