Revisiting multiple shapefiles from one server...

From: Ariane Schaefer <kittyhawk20164@yahoo.com>
Date: Mon Oct 01 2001 - 08:16:21 EDT

Hi everyone,

I've looked through the list archives and gotten some
great hints for serving multiple shapefiles from one
location. The idea I'm using is that each shapefile
will be handled by a LinkLayer class, which
communicates to one server that passes the connection
on to a new ShapeLinkServer that serves out a specific
shapefile. However, I am having problems. If I get
one shapefile, say countries, I can pan and zoom to my
heart's content without any problems. If I stay in one
place on the map, I can also get other shapefiles
without any trouble, such as cities, states, and
lakes. But if I have more than one shapefile on the
screen AND I want to pan and zoom, I frequently get
error messages and one or more layers will fail to
load. They don't completely die; additional panning
and zooming might bring them back, but there's usually
at least one missing at all times.

There are two error messages that can occur: both say
that there is a communication problem between
linkLayer and the host. One is a broken pipe, an IO
Exception, which occurs at the line props.write(link)
in LinkMapRequest.write() called by getGraphics in
LinkLayer. The other is an IO Exception (EOF). It
occurs in getGraphics of LinkLayer at the line
link.readAndParse().

These are the changes I have made to the code (marked
with a *):

LinkLayer:
in prepare(), in synchronized(l) block:
  *l.dos.writeBytes(shapefileType + "\n");
   list = getGraphics(l, projection);
   linkManager.finLink();
  *linkManager.resetLink(); //without this, every
other
                            //pan or zoom fails

LinkServerStarter:
in run(), after serverSocket.accept():
  *I set up a DataInputSteream(dis) and
LinkOutputStream(dos) to read shapefile type.
  *String shapefile="", str=null;
  *do {
        byte[] ba = new byte[1];
        ba[0] = dis.readByte();
         str = new String (ba, 0, 1);
        if(!(str.equals("\n")))
                shapefile=shapefile.concat(str);
        else break;
  *}while(!(str.equals("\n")));
  *Now I set shapefile according to request
  *((Thread)startSendServer(socket, shp,
ssx)).start();

New method in LinkServerStarter:
public Thread startSendServer(Socket sock, string shp,

   String ssx) {
        return new ShapeLinkServer(sock, shp, ssx);
}

I'm pretty sure the only other change I made was in
LinkLayer in getGraphics: just before
LinkMapRequest.write() I had to insert
link.dos.flush() in order to allow normal
communication to occur; without this line, I can only
get as far as making the request for a shapefile.

So, does anyone have any suggestions for what could be
going wrong? Also, does anyone know of a good
list/newsgroup to get more basic Java questions
answered? I'm also having some non-openmap related
applet problems. Thanks in advance for any help!

KittyHawk
 

__________________________________________________
Do You Yahoo!?
Listen to your Yahoo! Mail messages from any phone.
http://phone.yahoo.com

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Oct 1 08:18:06 2001

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:31 EDT