[Mapserver-users] Help with ArcSDE Layer Connection/Data spec ification

Pryor, Clayton J CJPRYOR at sandia.gov
Wed Oct 8 14:12:16 PDT 2003


Reading other posts on troubleshooting MapServer, I came across the
suggestion to run mapserv from the command line with the same parameters as
from the html page.  When I do so, I get interesting results as shown below.

./mapserv?map=/usr/local/apache2/htdocs/demoSNL/demo.map&layer=nercsubrgnsta
tus&zoomsize=2&program=/cgi-bin/mapserv&map_web_imagepath=/usr/local/apache2
/htdocs/tmp/&map_web_imageurl=/tmp/
[11] 9803
[12] 9804
[13] 9805
[14] 9806
bash: ./mapserv?map=/usr/local/apache2/htdocs/demoSNL/demo.map: No such file
or directory
[15] 9807
[10]   Done
map_web_imagepath=/usr/local/apache2/htdocs/tmp/
[11]   Exit 127
./mapserv?map=/usr/local/apache2/htdocs/demoSNL/demo.map
[12]   Done                    layer=nercsubrgnstatus
[13]   Done                    zoomsize=2
[14]   Done                    program=/cgi-bin/mapserv

The interesting thing about these results is that even though it says "No
such file or directory" with regard to the demo.map file, it is obviously
reading the demo.map file since that is where the connection information is
that is generating the missing layer error when the layer is not specified
properly (and it read it before I tried modifying it to use ArcSDE).  So, I
figure the problem must be with some file specification within the demo.map
file but I can not find anything that appears to be wrong.

I'm still baffled but perhaps this will help those of you who are trying to
help me.  In the mean-time, I will try starting over again from the existing
demo application.  My approach is to take the working demo application and
modify it to read a layer from ArcSDE instead of the default shape files.  I
started out by changing only what I thought needed to be changed.  However,
in the process of trying to debug the problem, I began commenting out more
and more things from the map file.

If this does not work I will go through the process of trying to build the
entire application from scratch.  It will be a good learning experience
anyway.

Any suggestions are appreciated.

Thanks again,

Clay Pryor

-----Original Message-----
From: Pryor, Clayton J 
Sent: Wednesday, October 08, 2003 2:18 PM
To: 'mapserver-users at lists.gis.umn.edu'
Cc: InSIST
Subject: RE: [Mapserver-users] Help with ArcSDE Layer Connection/Data
specification



Setting up the "esri_sde" alias in the /etc/services file is very nice and
works fine.

At one time I believed that my problem was with the name.  However, with the
combinations for specifying the name that I have been using and considering
Paul's comment about the name, I have come to believe that something else
must be going on.

Let me explain.  First, before posting my original message, I tried the
following DATA definitions:

1) DATA "nercSubRegions, shape"	#layer name with no schema
2) DATA "SDE.nercSubregions,shape"	#layer name with schema
3) DATA "insistdb.SDE.nercSubregions,shape"
4) DATA "insistdb.SDE.NorthAmerica.SDE.nercSubregions,shape"

Options 1 and 2 resulted in the following error:
	Internal Server Error: (from apache web server log)  "Premature end
of script headers: mapserv, referer: http://.../demoSNL/demo_init.html"

Options 3 and 4 resulted in the following error:
	Web page result:  "MapServer Message  msDrawMap():Image handling
error.  Failed to draw layer named 'nercsubrgnstatus'.  msSDELayerOpen():
SDE error.  SE_layer_get_infor(): Layer not found. (-20)"

Based on the errors alone (undefined internal mapserv error vs. Layer not
found error) I was originally thinking that options 3 and 4 were an
improvement over options 1 and 2.

However, with Paul's comments about the naming I began to realize that
options 1) and 2) were probably correct with regard to the name while
options 3 and 4 were off base.  Therefore, I tried the following
intentionally misnamed layers to see what resulted.

5) DATA "SDE.xx,shape" # garbage 1
6) DATA "xx,shape" # garbage 2

Both returned the Layer not found error.

This is disconcerting to me because it indicates that the correct naming is
returning an unreported error from mapserv.  To try to eliminate any other
script conflicts, I have tried to simplify my application as much as
possible by eliminating all but the basics.

I am including all of the relevant source code in this email in hopes that
someone can make sense of the problem.  Please let me know if there are
other files that I should attach.

Perhaps this is some sort of configuration problem????

Once again, thanks in advance for any help.

****************************************************************************
demo_init.html
****************************************************************************

<html>
<head><title>MapServer DemoSNL Interface</title></head>
<body bgcolor="#FFFFFF">

<center><h2>MapServer DemoSNL Interface</h2></center>
<p><hr><p>
Click on the initialize button to fire up the demo.  

<form method=GET action="/cgi-bin/mapserv">

<input type="hidden" name="map"
value="/usr/local/apache2/htdocs/demoSNL/demo.map">
<input type="hidden" name="layer" value="nercsubrgnstatus">
<input type="hidden" name="zoomsize" value=2>

<input type="hidden" name="program" value="/cgi-bin/mapserv">
<input type="hidden" name="map_web_imagepath"
value="/usr/local/apache2/htdocs/tmp/">
<input type="hidden" name="map_web_imageurl" value="/tmp/">

<center><input type="submit" value="Initialize"></center>

</form>

<p><hr><p>

</body></html>


****************************************************************************
demo.html
****************************************************************************

<html>
<head><title>MapServer Demo Interface</title></head>
<body bgcolor=#FFFFFF>

<center><h1>MapServer Demo Interface</h1></center>
<hr>
<form method=GET action="[program]">

<center>
<table border=0 cellspacing=0 cellpadding=4 bgcolor="#000000">
<tr>
<td valign="top" align=center>
  <table cellpadding="0" cellspacing="0" border="0">
    <tr><td colspan="2"><INPUT NAME="img" TYPE="image" SRC="[img]" width=600
height=600 border=0></td></tr>
    <tr>
      <td> <font size=-1 face="arial,helvetica"
color="#FFFFFF"><b>Powered by MapServer</b></font></td>
      <td align="right"><img src="[scalebar]"></td>
    </tr>
  </table>
</td>
<td valign="top" bgcolor=#ffffff>
  <table cellpadding="5" cellspacing="0" border="0" bgcolor="#ffffff">
    <tr><td>
      <center><input type="submit" value="Refresh/Query"></center>
      <p>

      <input type="radio" name="mode" value="browse" checked> <b>Browse
map</b><br>
      <input type="radio" name="mode" value="query"> <b>Query
feature</b><br>
      <input type="radio" name="mode" value="nquery"> <b>Query multiple
features</b>

      <hr>

      <p>
      Zoom In <input type=radio name=zoomdir value=1 [zoomdir_1_check]>
      Pan <input type=radio name=zoomdir value=0 [zoomdir_0_check]>
      Zoom Out <input type=radio name=zoomdir value=-1 [zoomdir_-1_check]>
      <p>
      Zoom Size <input type=text name=zoomsize size=4 value=[zoomsize]>
      <p>

      <font size=+1><b>Legend</b></font><br><hr>
      <img src="[legend]"><hr>

      <p>
      <center><INPUT NAME="ref" TYPE="image" SRC="[ref]"
border="0"></center>
    </td></tr></table>

  </td></tr>
</table>
</center>

<input type="hidden" name="imgxy" value="299.5 299.5">
<input type="hidden" name="imgext" value="[mapext]">
<input type="hidden" name="map" value="[map]">
<input type="hidden" name="savequery" value="true">

<input type="hidden" name="program" value="[program]">
<input type="hidden" name="map_web_imagepath" value="[map_web_imagepath]">
<input type="hidden" name="map_web_imageurl" value="[map_web_imageurl]">

</form>

<p><hr><p>

</body></html>


****************************************************************************
demo.map
****************************************************************************

#
# Start of map file
#
NAME DEMO
STATUS ON
SIZE 600 600
#TODO: LOOKUP EXTENT
#EXTENT 388107.634400379 5203120.88405952 500896.339019834 5310243.30613897
EXTENT -8574351.87399496 -8362643.00728895 9017834.16222906 9229543.02893507
UNITS METERS
# SHAPEPATH "data"
IMAGECOLOR 255 255 255

# you may need to change this to match your MapServer build
#IMAGETYPE PNG

#
# Projection definition, consult the PROJ.4 documentation for parameter
discussion
#
#PROJECTION
#  "proj=utm"
#  "ellps=GRS80"
#  "zone=15"
#  "north"
#  "no_defs"
#
#  OR: 
#
#  "init=epsg:26915"
#END

#
# Start of web interface definition (including WMS enabling metadata)
#
WEB
#  HEADER demo_header.html
  TEMPLATE demo.html
#  FOOTER demo_footer.html
  MINSCALE 1000
  MAXSCALE 1550000
#  IMAGEPATH "set in demo_init.html"
#  IMAGEURL "set in demo_init.html"
#  METADATA
#    WMS_TITLE "UMN MapServer SNL Demo"
#    WMS_ABSTRACT "This is the UMN MapServer demonstration application as
modified for SNL."
#    WMS_ACCESSCONSTRAINTS none

    # change this value to match your setup
#    WMS_ONLINERESOURCE "http://134.253.158.45/demoSNL/demo_init.html"

#    WMS_SRS "EPSG:26915"
#  END
END

QUERYMAP
  SIZE 200 200
  STATUS OFF
  STYLE HILITE
  COLOR 255 0 0
END

#
# Start of reference map
#
REFERENCE
  IMAGE graphics/reference.png  # todo: change this!
#  EXTENT 393234.393701263 5205405.16440722 495769.579718949
5307959.02579127
  EXTENT -8574351.87399496 -8362643.00728895 9017834.16222906
9229543.02893507
  SIZE 120 120
  STATUS OFF
  COLOR -1 -1 -1
  OUTLINECOLOR 255 0 0
END

#
# Start of legend
#
LEGEND
  KEYSIZE 18 12
  LABEL
    TYPE BITMAP
    SIZE MEDIUM
    COLOR 0 0 89
  END
  STATUS OFF
END

#
# Start of scalebar
#
SCALEBAR
  IMAGECOLOR 255 255 255
  LABEL
    COLOR 255 255 255
    SIZE tiny    
  END
  STYLE 1
  SIZE 80 2
  COLOR 255 255 255
  UNITS MILES
  INTERVALS 1
#  TRANSPARENT TRUE
#  STATUS TRUE
  STATUS OFF
END

#
# Start of symbol definitions (we're only using a few)
#
#SYMBOL
#  NAME 'circle'
#  TYPE ELLIPSE
#  POINTS 1 1 END
#  FILLED TRUE
#END

#
# Start of layer definitions
#

LAYER
  NAME nercsubrgnstatus
#  CONNECTION "sde_w-24,port:5151,INSISTDB,usrID,usrPwd"
#  CONNECTION "sde_w-24,port:5151,,usrID,usrPwd"
#  CONNECTION "ORCA-WKS-1,port:5151,INSISTDB,usrID,usrPwd"
#  CONNECTION "ORCA-WKS-1,port:5151,,usrID,usrPwd"
#  CONNECTION "ORCA-WKS-1,sde_w-24,SDE,usrID,usrPwd"
#  CONNECTION "ORCA-WKS-1,port:5151,SDE,usrID,usrPwd"
#  CONNECTION "ORCA-WKS-1,port:5151,null,usrID,usrPwd"
#  CONNECTION "orca-wks-1,port:5151,null,usrID,usrPwd"
#  CONNECTION "orca-wks-1,port:5151,insistdb,usrID,usrPwd"
  CONNECTION "orca-wks-1,esri_sde,insistdb,usrID,usrPwd"

  CONNECTIONTYPE sde
  TYPE POLYGON
  STATUS DEFAULT

  DATA "nercSubRegions,shape"
#  DATA "SDE.nercSubRegions,shape"
##  DATA "SDE.SDE.nercSubRegions,shape"
##  DATA "SDE.SDE.NorthAmerica.nercSubRegions,shape"
##  DATA "SDE.NorthAmerica.nercSubRegions,SHAPE"
##  DATA "insistdb.SDE.nercSubRegions,shape"
##  DATA "insistdb.SDE.NorthAmerica.SDE.nercSubRegions,shape"
##  DATA "insistdb.SDE.NorthAmerica.nercSubRegions,shape"
##  DATA "insistdb.NorthAmerica.nercSubRegions,shape"
##  DATA "insistdb.xx,shape"
##  DATA "SDE.xx,shape"
##  DATA "xx,shape"

  CLASSITEM 'NERC_SubRegions'
#  CLASS
#    EXPRESSION 'Itasca'
#    OUTLINECOLOR 128 128 128
#    COLOR 225 225 185
#  END
  CLASS # build classes by status later
    EXPRESSION /./ 
#    SIZE 2 # will this make the lines thicker?
    OUTLINECOLOR 128 128 128
    COLOR 0 255 0
  END
#  METADATA
#    WMS_TITLE "County Boundary"
#    WMS_ABSTRACT "Itasca County boundary shapefile. See
http://deli.dnr.state.mn.us/metadata/full/ctybdne2.html for more
information."
#    WMS_SRS "EPSG:26915"
#  END
END

#LAYER
#  NAME usstates
#  GROUP cities  # don't use here but good for Canada and Mexico
#  TYPE POLYGON
#  CONNECTION "ORCA-WKS-1,port:5151,SDE,usrID,usrPwd"
#  CONNECTIONTYPE sde
#  DATA "SDE.UNITEDSTATES,SHAPE"
#  DATA "UNITEDSTATES,SHAPE"
#  STATUS DEFAULT
#  CLASSITEM US_States_Outline
#  CLASS
#    NAME "US States Outlines"
#    EXPRESSION /./
#    OUTLINECOLOR 128 128 128
#    COLOR 255 255 255 # should be transparrent
#    TEMPLATE "mcd90py2.html"
#  END

#END # usstates

END # Map File


Sincerely,

Clay Pryor


   ------------------------------------------------------------
   Clayton J. Pryor	phone	(505) 845-3557
   Sandia National Laboratories	
   Critical Infrastructure Surety 	fax	(505) 844-9641
   PO Box 5800 MS 0451			 
   Albuquerque NM 87185-0451	email	cjpryor at sandia.gov
   ------------------------------------------------------------



-----Original Message-----
From: Paul Ramsey [mailto:pramsey at refractions.net]
Sent: Wednesday, October 08, 2003 12:18 PM
To: Pryor, Clayton J
Cc: 'mapserver-users at lists.gis.umn.edu'; InSIST
Subject: Re: [Mapserver-users] Help with ArcSDE Layer Connection/Data
specification


Pryor, Clayton J wrote:

> ArcSDE server information (per our ArcSDE/Oracle database manager):
> 
> 	host name:  orca-wks-1
> 	instance name: port:5151
> 	database name: insistdb
> 
> 
> Map File Connection Definition:
> 
> 	NAME nercsbrgnstatus
> 	CONNECTION "orca-wks-1,port:5151,insistdb,userid,userpwd"
> 	CONNECTIONTYPE sde

Two possible things, firstly, are you sure that 'port:5151' is what you 
want for your instance? You could try a bare '5151'. Or you could edit 
/etc/services and add esri_sde there as a tcp service on port 5151, then 
use 'esri_sde' as the instance. SDE is wierd.
Secondly, it looks like your table name is right, but you can never be 
too sure. Tables I have used have almost always been inside schemas, and 
were referenced as SCHEMANAME.TABLENAME.
Paul


-- 
       __
      /
      | Paul Ramsey
      | Refractions Research
      | Email: pramsey at refractions.net
      | Phone: (250) 885-0632
      \_





More information about the MapServer-users mailing list