Darn I am out of time, and most module maintainers are away for the 
holidays.
Jesse is the maintainer for rendering, and Ian the maintainer for MapPanel.

Good to know your data is in order, perhaps start with a working example 
and build it into what you want.
Sorry I could not be more help,
Jody
> Dear Jody Garnett,
>     Thanks for the reply.., I greatly appreciate it....
>  
> Answer to your questions:
>     1) Yes shapefiles have .prj files.
>     2) And shape files are in "WGS84/ UTM Zone 43N"
>     3) In UDIG these shapefiles are coming properly,for 
> the default(WGS84) as well as selected "WGS84/UTM Zone 43N" CRS.
>    
> Now I started using the CRS in my program, but still I am getting the 
> streched map image.....
>  
> Following is the code I am using for this process:......
>  
>          String code = "32643";
>          CoordinateReferenceSystem crs = 
> FactoryFinder.getCRSAuthorityFactory(
>            "EPSG", null).createCoordinateReferenceSystem(code);       
>  
>         this.mapContext = new DefaultMapContext(crs);
>  
>         Envelope env = this.mapContext.getAreaOfInterest();
>
>         //map.addlayers.....adding all the shapefiles.
>  
>         //Rendering....
>        BufferedImage bufferedImage = null;
>         bufferedImage = new BufferedImage(width, height, 
> BufferedImage.TYPE_INT_RGB);
>         Graphics2D graphics2D = (Graphics2D)bufferedImage.getGraphics();
>         graphics2D.setRenderingHints(new
>         RenderingHints(RenderingHints.KEY_RENDERING, 
> RenderingHints.VALUE_RENDER_SPEED));
>         graphics2D.setColor(Color.WHITE);
>         graphics2D.fillRect(0, 0, width, height);          
>         RenderingHints hints = new 
> RenderingHints(RenderingHints.KEY_ANTIALIASING,
>           RenderingHints.VALUE_ANTIALIAS_ON );
>         streamingRenderer.setJava2DHints(hints);
>         //we already do everything that the optimized data loading  
> does...
>         //if we set it to true then it does it all twice...
>         Map rendererParams = new HashMap();
>         rendererParams.put("optimizedDataLoadingEnabled",new 
> Boolean(true));
>         streamingRenderer.setRendererHints(rendererParams);
>         try
>            {
>               streamingRenderer.paint(graphics2D, new Rectangle(width, 
> height), env);
>            } catch(Exception ex)  {
>                   ex.printStackTrace();
>            }
>  
>            if (graphics2D!=null) graphics2D.dispose();
>  
>            ServletOutputStream sos = res.getOutputStream();
>            ImageIO.write(bufferedImage,"jpg",sos);
>        
>         //image is thrown out... here.
>  
>  
> Can you please suggest me what is that I am missing in my program......??
>  
>  
>  
>  
> Best Regards
>   Govardhan
>  
>  
> ----- Original Message -----
> From: "Jody Garnett" <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>>
> To: "Govardhan" <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>>
> Cc: <[email protected] 
> <mailto:[email protected]>>; <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>>
> Sent: Wednesday, December 20, 2006 10:18 AM
> Subject: Re: My map is looking streched... Please help me
>
> > Evening Mr Govardhan ...
> >
> > I think you are going to have to use the CRS that matches your data,
> > does your data have prj files? You may want to try out your shapefiles
> > with uDig just to confirm they are working correctly.
> >
> > Cheers,
> > Jody
> >> Dear Sir/Madam,
> >>     I am having problem in bringing up my Georeferenced map on the 
> screen.
> >> I am using DefaultMapContext() to create map, and not using any CRS.
> >> 
> >> I have attached the map image, please help me how to resolve this.
> >> 
> >> I am using the following code to create the map,
> >> 
> >>  private void renderMap(MapHelper mapHelper, HttpServletRequest req,
> >> HttpServletResponse res)
> >>  throws ServletException, IOException {
> >>  
> >>         StreamingRenderer streamingRenderer = new StreamingRenderer();
> >>         MapContext mapContext = mapHelper.getMapContext();
> >>         streamingRenderer.setContext(mapContext);
> >> 
> >>         System.out.println("inside rendermap");
> >>       
> >>         int width = 0;
> >>         int height = 0;
> >>       
> >>         if(req.getParameter("mapWidth") != null) {
> >>          width = Integer.parseInt(req.getParameter("mapWidth"));
> >>          mapHelper.setImageWidth(width);
> >>         }
> >>       
> >>         if(req.getParameter("mapHeight") != null) {
> >>          height = Integer.parseInt(req.getParameter("mapHeight"));
> >>          mapHelper.setImageHeight(height);
> >>         }
> >>       
> >>         System.out.println("imageWidth=" + width + ", imageHeight=" +
> >> height);
> >>       
> >>         BufferedImage bufferedImage = null;
> >>         bufferedImage = new BufferedImage(width, height,
> >> BufferedImage.TYPE_INT_RGB);
> >>         Graphics2D graphics2D = 
> (Graphics2D)bufferedImage.getGraphics();
> >>         graphics2D.setRenderingHints(new
> >>         RenderingHints(RenderingHints.KEY_RENDERING,
> >> RenderingHints.VALUE_RENDER_SPEED));
> >>         graphics2D.setColor(Color.WHITE);
> >>         graphics2D.fillRect(0, 0, width, height);         
> >>         RenderingHints hints = new
> >> RenderingHints(RenderingHints.KEY_ANTIALIASING,
> >>           RenderingHints.VALUE_ANTIALIAS_ON );
> >>         streamingRenderer.setJava2DHints(hints);
> >>       
> >>         //we already do everything that the optimized data loading 
> >> does...
> >>         //if we set it to true then it does it all twice...
> >>         Map rendererParams = new HashMap();
> >>         rendererParams.put("optimizedDataLoadingEnabled",new
> >> Boolean(true));
> >>         Envelope env = mapHelper.getEnvelope();
> >>     
> >>       
> >>         streamingRenderer.setRendererHints(rendererParams);
> >>         try
> >>            {
> >>          System.out.println("long=" + env.centre().x + ", lat=" +
> >> env.centre().y);
> >>  private void renderMap(MapHelper mapHelper, HttpServletRequest req,
> >> HttpServletResponse res)
> >>  throws ServletException, IOException {
> >>  
> >>         StreamingRenderer streamingRenderer = new StreamingRenderer();
> >>         MapContext mapContext = mapHelper.getMapContext();
> >>         streamingRenderer.setContext(mapContext);
> >> 
> >>         System.out.println("inside rendermap");
> >>       
> >>         int width = 0;
> >>         int height = 0;
> >>       
> >>         if(req.getParameter("mapWidth") != null) {
> >>          width = Integer.parseInt(req.getParameter("mapWidth"));
> >>          mapHelper.setImageWidth(width);
> >>         }
> >>       
> >>         if(req.getParameter("mapHeight") != null) {
> >>          height = Integer.parseInt(req.getParameter("mapHeight"));
> >>          mapHelper.setImageHeight(height);
> >>         }
> >>       
> >>         System.out.println("imageWidth=" + width + ", imageHeight=" +
> >> height);
> >>       
> >>         BufferedImage bufferedImage = null;
> >>         bufferedImage = new BufferedImage(width, height,
> >> BufferedImage.TYPE_INT_RGB);
> >>         Graphics2D graphics2D = 
> (Graphics2D)bufferedImage.getGraphics();
> >>         graphics2D.setRenderingHints(new
> >>         RenderingHints(RenderingHints.KEY_RENDERING,
> >> RenderingHints.VALUE_RENDER_SPEED));
> >>         graphics2D.setColor(Color.WHITE);
> >>         graphics2D.fillRect(0, 0, width, height);         
> >>         RenderingHints hints = new
> >> RenderingHints(RenderingHints.KEY_ANTIALIASING,
> >>           RenderingHints.VALUE_ANTIALIAS_ON );
> >>         streamingRenderer.setJava2DHints(hints);
> >>       
> >>         //we already do everything that the optimized data loading 
> >> does...
> >>         //if we set it to true then it does it all twice...
> >>         Map rendererParams = new HashMap();
> >>         rendererParams.put("optimizedDataLoadingEnabled",new
> >> Boolean(true));
> >>         Envelope env = mapHelper.getEnvelope();
> >>     
> >>       
> >>         streamingRenderer.setRendererHints(rendererParams);
> >>         try
> >>            {
> >>             streamingRenderer.paint(graphics2D, new Rectangle(width,
> >> height), env);
> >>  
> >>            } catch(Exception ex)  {
> >>                   ex.printStackTrace();
> >>            }
> >> 
> >>            if (graphics2D!=null) graphics2D.dispose();
> >> 
> >>            ServletOutputStream sos = res.getOutputStream();
> >>            ImageIO.write(bufferedImage,"jpg",sos);
> >>            sos.close();
> >>          
> >>  }           } catch(Exception ex)  {
> >>                   ex.printStackTrace();
> >>            }
> >> 
> >>            if (graphics2D!=null) graphics2D.dispose();
> >> 
> >>            ServletOutputStream sos = res.getOutputStream();
> >>            ImageIO.write(bufferedImage,"jpg",sos);
> >>            sos.close();
> >>          
> >>  }
> >> 
> >> 
> >> private MapHelper( ServletContext servletContext , HttpSession
> >> httpSession) throws IOException{
> >> 
> >>          URL shapeURL1 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/District_Border_region.shp");
> >>          URL sldURL1 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/District_Border_region.sld");
>          
>
> >>
> >>       loadContext(shapeURL1, sldURL1, "District_Border_region");
> >> 
> >>       URL shapeURL2 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/District_Headquarter_font_point.shp");
> >>          URL sldURL2 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/District_Headquarter_font_point.sld");
>         
>
> >>
> >>       loadContext(shapeURL2, sldURL2, 
> "District_Headquarter_font_point");
> >> 
> >>          URL shapeURL3 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/Major_Road_polyline.shp");
> >>          URL sldURL3 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/Major_Road_polyline.sld");
>          
>
> >>
> >>       loadContext(shapeURL3, sldURL3, "Major_Road_polyline");
> >> 
> >>          URL shapeURL4 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/National_Highway_polyline.shp");
> >>          URL sldURL4 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/National_Highway_polyline.sld");
>          
>
> >>
> >>       loadContext(shapeURL4, sldURL4, "National_Highway_polyline");
> >> 
> >>          URL shapeURL5 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/State_Border_region.shp");
> >>          URL sldURL5 =
> >> 
> servletContext.getResource("/WEB-INF/data/bangalore2/State_Border_region.sld");
>          
>
> >>
> >>       loadContext(shapeURL5, sldURL5, "State_Border_region");
> >> 
> >>          Envelope env = mapContext.getLayerBounds();
> >>          setEnvelope(env);
> >>          if (mapContext == null)
> >>          {
> >>           System.out.println("MapContext is not valid");
> >>          }
> >> 
> >> }
> >>  /**
> >>     * Load the data from the specified shapefile and construct a
> >> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]> 
> >> Context 
> context}
> >>     * with a default style.
> >>     *
> >>     * @param  url The url of the shapefile to load.
> >>     * @return Context The data from the shape file.
> >>     * @throws IOException is a I/O error occured.
> >>     * @throws DataSource if an error occured while reading the data
> >> source.
> >>     */
> >>    protected void loadContext(final URL url, final URL sld, String
> >> layername) throws IOException, DataSourceException {
> >>      
> >>        // Load the file
> >>        if (url == null) {
> >>            throw new FileNotFoundException("Resource not found");
> >>        }
> >>        final DataStore store = new ShapefileDataStore(url);
> >>        final FeatureSource features =
> >> store.getFeatureSource(store.getTypeNames()[0]);
> >>      
> >>        // Create the style
> >>        final Style style;
> >>        if(sld != null){
> >>            SLDParser styleReader = new
> >> SLDParser(StyleFactoryFinder.createStyleFactory(), sld);
> >>            style = styleReader.readXML()[0];
> >>        }
> >>        else
> >>        {
> >>            final StyleBuilder builder = new StyleBuilder();
> >>          
> >>            Class geometryClass =
> >> features.getSchema().getDefaultGeometry().getType();
> >>            if(LineString.class.isAssignableFrom(geometryClass) ||
> >> MultiLineString.class.isAssignableFrom(geometryClass)) {
> >>                style =
> >> builder.createStyle(builder.createLineSymbolizer());
> >>            } else if(Point.class.isAssignableFrom(geometryClass) ||
> >> MultiPoint.class.isAssignableFrom(geometryClass)) {
> >>                style =
> >> builder.createStyle(builder.createPointSymbolizer());
> >>            } else {
> >>                style =
> >> builder.createStyle(builder.createPolygonSymbolizer(
> >>                Color.ORANGE, Color.BLACK, 1));
> >>            }
> >>        }
> >> 
> >>        // Create the context
> >>        MapLayer layer = new DefaultMapLayer(features, style);
> >>        layer.setTitle(layername);
> >>        mapContext.addLayer(layer);
> >>    }
> >> 
> >> 
> >> 
> >> 
> >> 
> >> Best Regards
> >>   Govardhan
> >>
> >> 
> ------------------------------------------------------------------------
> >>
> >


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to