Re: [OpenMap Users] DTED problem

From: Don Dietrick <dietrick_at_bbn.com>
Date: Thu, 22 Dec 2005 10:51:39 -0500

Hi Denny,

The CADRG projection does look different than the Mercator
projection, probably a little more stretched horizontally. If the
projection isn't CADRG it would prevent the coverage from showing up.

Does the openmap.properties file you are using for the servlet work
for an OpenMap application? Sometimes it's helpful to check the
layer settings in the application before running them in the servlet.

You can also turn on some debug flags in the openmap.properties file:

openmap.Debug=imageserver dted

That works if you call Debug.init() in your servlet code at startup,
you'll get more messages to stdout.

- Don


On Dec 21, 2005, at 1:47 PM, Denny Lee wrote:

> Hello Don,
> I tried reducing the scale. I continue to only see
> the little DTED boxes and the underlying shp layer. I
> still do not see any DTED data. Do I need to do
> something in the servlet code to make the DTED layer
> show up? Also, should the CADRG projection look any
> different than the Mercator projection? The image I
> am getting back looks like it is a Mercator even
> though I requested CADRG.
>
> Thanks for your help.
>
> Denny
>
> --- Don Dietrick <dietrick_at_bbn.com> wrote:
>
>> Hi Denny,
>>
>> The scale number is too big, the DTEDLayer thinks it
>> shouldn't
>> respond to it. There's a min.scale property for the
>> layer you can
>> set so that the DTEDLayer would try to respond to
>> the request, but it
>> might take a while since many files would need to be
>> read to do that.
>>
>> Regards,
>>
>> - Don
>>
>> On Dec 21, 2005, at 12:10 PM, Denny Lee wrote:
>>
>>> Hello,
>>> I am new to Openmap and I am trying to create a
>>> servlet to generate map images. The servlet code
>> is as
>>> follows:
>>>
>>> package OpenMapTest;
>>>
>>> //This works!
>>>
>>> import java.io.File;
>>> import java.io.FileInputStream;
>>> import java.io.FileNotFoundException;
>>> import java.io.IOException;
>>> import java.util.Properties;
>>>
>>> import javax.servlet.ServletConfig;
>>> import javax.servlet.ServletException;
>>> import javax.servlet.UnavailableException;
>>> import javax.servlet.http.*;
>>>
>>> import com.bbn.openmap.Environment;
>>> import com.bbn.openmap.Layer;
>>> import com.bbn.openmap.image.*;
>>> import com.bbn.openmap.layer.GraticuleLayer;
>>> import com.bbn.openmap.layer.DateLayer;
>>> import
>> com.bbn.openmap.layer.daynight.DayNightLayer;
>>> import com.bbn.openmap.layer.etopo.ETOPOLayer;
>>> import com.bbn.openmap.layer.shape.ShapeLayer;
>>> import com.bbn.openmap.plugin.PlugIn;
>>> import com.bbn.openmap.plugin.PlugInLayer;
>>> import com.bbn.openmap.proj.Mercator;
>>> import com.bbn.openmap.proj.Proj;
>>> import com.bbn.openmap.proj.Projection;
>>> import com.bbn.openmap.proj.ProjectionFactory;
>>> import com.bbn.openmap.util.ComponentFactory;
>>> import com.bbn.openmap.util.PropUtils;
>>>
>>> //http://localhost:8080/OpenMapTest/MapServlet?
>>>
>>
> REQUEST=MAP&SCALE=500000000&LAT=32.3800&LON=-117.90&HEIGHT=600&WIDTH=8
>>
>>>
>>
> 00&PROJTYPE=mercator&LAYERS=date,cities,test,graticule,demo,shapePolit
>>
>>> ical
>>> //http://localhost:8080/OpenMapTest/MapServlet?
>>>
>>
> REQUEST=MAP&SCALE=500000000&LAT=32.3800&LON=-117.90&HEIGHT=600&WIDTH=8
>>
>>>
>>
> 00&PROJTYPE=CADRG&LAYERS=date,cities,test,graticule,demo,shapePolitica
>>
>>> l
>>> //http://localhost:8080/OpenMapTest/MapServlet?
>>>
>>
> REQUEST=MAP&SCALE=500000000&LAT=32.3800&LON=-117.90&HEIGHT=600&WIDTH=8
>>
>>> 00&PROJTYPE=CADRG&LAYERS=jdted,shapePolitical
>>>
>>> public class MapServlet3 extends HttpServlet {
>>> //Logger logger =
>>> Logger.getLogger(MapServlet.class);
>>> Layer dateLayer;
>>> Layer[] layers;
>>> AcmeJPEGFormatter formatter = new
>>> AcmeJPEGFormatter();
>>> Properties configProperties;
>>> Projection defaultProjection;
>>> MapRequestHandler iServer;
>>>
>>>
>>> public void createLayers(Properties p)
>>> {
>>> dateLayer =
>>> makeLayer("com.bbn.openmap.layer.DateLayer",
>> "date",
>>> p);
>>> System.out.println("DateLayer isa " +
>>> dateLayer.toString());
>>> layers = new Layer[] { dateLayer };
>>> }
>>>
>>>
>>> public Layer makeLayer(String className,
>> String
>>> layerName, Properties p)
>>> {
>>> Object obj =
>> ComponentFactory.create(className,
>>> layerName, p);
>>>
>>> if (obj instanceof Layer || obj instanceof
>>> PlugIn) {
>>> Layer l = null;
>>>
>>> if (obj instanceof PlugIn) {
>>> PlugIn pi = (PlugIn) obj;
>>> PlugInLayer pil = new PlugInLayer();
>>> pil.setPlugIn(pi);
>>>
>>>
>>
> pil.setName(p.getProperty(PropUtils.getScopedPropertyPrefix(pi)
>>> + Layer.PrettyNameProperty));
>>> l = pil;
>>> } else {
>>> l = (Layer) obj;
>>> }
>>>
>>> return l;
>>> }
>>>
>>> return null;
>>> }
>>>
>>> //
>>> public void init(ServletConfig conf) throws
>>> ServletException {
>>> super.init(conf);
>>> String basePath =
>>> getServletContext().getRealPath("/");
>>> //String propFile = basePath +
>>> conf.getInitParameter("openmap.properties");
>>>
>>> String propFile = basePath +
>>> "openmap.properties";
>>> System.out.println("Requesting data from
>>> properties file: " + propFile);
>>> try {
>>> File f = new File(propFile);
>>> System.out.println("File f = " + f);
>>> System.out.println("exists=" +
>>> f.exists());
>>> System.out.println("readable=" +
>>> f.canRead());
>>> System.out.println("writeable=" +
>>> f.canWrite());
>>>
>>> FileInputStream fis = new
>>> FileInputStream(f);
>>>
>>> configProperties = new Properties();
>>>
>>> configProperties.load(fis);
>>>
>>>
>>>
>>> createLayers(configProperties);
>>>
>>> } catch (FileNotFoundException e) {
>>> System.out.println("File not found " +
>>> e.toString());
>>> throw new
>>> UnavailableException(e.getLocalizedMessage());
>>> } catch (IOException e) {
>>> System.out.println("IO Exception " +
>> e.toString());
>>> throw new
>>> UnavailableException(e.getLocalizedMessage());
>>> }
>>> }
>>>
>>>
>>>
>>> public void doGet(HttpServletRequest request,
>>> HttpServletResponse response) throws IOException {
>>>
>>> response.setContentType("image/jpeg");
>>> System.out.println("in doGet " +
>>> request.getQueryString() );
>>> Properties requestProperties = new
>>> Properties(configProperties);
>>> byte[] returnImage = null;
>>>
>>> String requestParameters =
>>> request.getQueryString();
>>>
>>> // Add any request-specific properties
>> here.
>>> byte[] image = null;
>>>
>>>
>>>
>>
> === message truncated ===

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Dec 22 2005 - 10:52:05 EST

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT