Problems with MapServer and Postgis - find_srid()

Ken Lord kenlord at GMAIL.COM
Thu Aug 11 11:35:26 PDT 2005


Hi Leonardo,
 I suspect that when you placed the shapefile into PostGIS, you may not have 
set the SRID value:
 shp2pgsql ...... -s 26910 .... 
 Try a DATA string something like this:
  DATA "the_geom from (SELECT * from mylayer) as foo using unique gid using 
SRID=26910"
 ... use the SRID number appropriate for you.
 Cheers,
Ken Lord
Vancouver BC
 On 8/11/05, Leonardo Lamarca <lamarca at acquasoftware.com.br> wrote: 
> 
> Hi everyone!
> 
> I need a help! I am running Mapserver 4.6.0 in Linux with PostgreSQL
> 7.4.5 and Postgis 1.0.3
> I am trying to run my first web-map application using Postgis. When I
> call de mapfile, MapServer return this error below.
> 
> I have an web-map application running with shape files. I converted
> these shape files to PostgreSQL using shp2pgsql and change mapfile to 
> connect and get data through PostgreSQL.
> 
> Regards,
> Leonardo Lamarca
> 
> =========================================================
> 
> msDrawMap(): Image handling error. Failed to draw layer named 'uf'.
> prepare_database(): Query error. Error executing POSTGIS DECLARE (the
> actual query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT
> 
> REGIAO::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),OID::text
> from public.br_uf WHERE the_geom && setSRID('BOX3D(-79.1998333333333
> -33.751,-27.1691666666667 5.272)'::BOX3D, find_srid('','public.br_uf
> ','the_geom') )'
> 
> Postgresql reports the error as 'ERROR: find_srid() - couldnt find the 
> corresponding SRID - is the geometry registered in the GEOMETRY_COLUMNS
> table? Is there an uppercase/lowercase missmatch? '
> 
> More Help:
> 
> Error with POSTGIS data variable. You specified '<check your .map file>'. 
> Standard ways of specifiying are :
> (1) 'geometry_column from geometry_table'
> (2) 'geometry_column from (<sub query>) as foo using unique <column
> name> using SRID=<srid#>'
> 
> Make sure you put in the 'using unique <column name>' and 'using SRID=#' 
> clauses in.
> 
> For more help, please see http://postgis.refractions.net/documentation.php
> 
> Mappostgis.c - version of Jan 23/2004.
> 
> ================================================================ 
> 
> Part of my mapfile:
> 
> 
> MAP
> NAME "my2ndmap"
> EXTENT -73.991 -33.751 -32.378 5.272
> FONTSET "fontset.txt"
> IMAGETYPE PNG
> #SHAPEPATH "mapas" 
> SIZE 600 450
> SYMBOLSET "symbolset.sym"
> STATUS ON
> UNITS DD # sim. é necessário especificar a unidade de
> medida usada pelo MAP->PROJECTION
> 
> #~ PROJECTION
> #~ "init=epsg:4291" # <4291> +proj=longlat +ellps=GRS67
> +towgs84=-57,1,-41,0,0,0,0 no_defs <>
> #~ END
> 
> WEB
> IMAGEPATH "/var/www/html/my2ndmap/tmp/" 
> IMAGEURL "/my2ndmap/tmp/"
> MINSCALE 25000
> MAXSCALE 35000000
> TEMPLATE "web_template.html"
> HEADER "web_header.html" 
> FOOTER "web_footer.html"
> LOG "/var/www/html/my2ndmap/log"
> END
> 
> QUERYMAP
> COLOR 0 0 255
> SIZE 300 225 
> STATUS ON
> STYLE HILITE
> END
> 
> LEGEND
> IMAGECOLOR 255 255 255
> POSITION UR
> KEYSIZE 12 10
> STATUS ON 
> LABEL
> ANTIALIAS TRUE
> SIZE SMALL
> TYPE BITMAP
> COLOR 0 0 0
> END
> END
> 
> REFERENCE
> COLOR -1 -1 -1 
> EXTENT -73.991 -33.751 -32.378 5.272
> IMAGE "br_refmap.png"
> MAXBOXSIZE 119
> OUTLINECOLOR 255 0 0
> SIZE 120 90 
> STATUS ON
> END
> 
> SCALEBAR
> COLOR 255 0 0
> INTERVALS 3
> OUTLINECOLOR 0 0 0
> POSITION LR
> SIZE 200 3 
> STATUS EMBED
> STYLE 0
> UNITS KILOMETERS
> LABEL
> ANTIALIAS TRUE
> SIZE SMALL
> TYPE BITMAP 
> COLOR 0 0 0
> END
> END
> 
> 
> LAYER # uf
> #~ PROJECTION
> #~ "init=epsg:4291" # <4291> +proj=longlat +ellps=GRS67
> +towgs84=-57,1,-41,0,0,0,0 no_defs <> 
> #~ END
> NAME "uf"
> DEBUG on
> CONNECTIONTYPE postgis
> CONNECTION "user=[*******] password=[*******] dbname=gis_teste01
> host=localhost" 
> TYPE POLYGON
> DATA "the_geom from public.br_uf "
> STATUS DEFAULT
> CLASSITEM "REGIAO"
> CLASS 
> NAME "Norte"
> EXPRESSION "NORTE"
> OUTLINECOLOR 46 92 92
> COLOR 0 192 0
> END
> CLASS
> NAME "Nordeste"
> EXPRESSION "NORDESTE"
> OUTLINECOLOR 46 92 92
> COLOR 192 192 192
> END
> CLASS 
> NAME "Centroeste"
> EXPRESSION "CENTROESTE"
> OUTLINECOLOR 46 92 92
> COLOR 255 128 128
> END
> CLASS 
> NAME "Sudeste"
> EXPRESSION "SUDESTE"
> OUTLINECOLOR 46 92 92
> COLOR 255 255 128
> END
> CLASS 
> NAME "Sul"
> EXPRESSION "SUL"
> OUTLINECOLOR 46 92 92
> COLOR 128 128 255
> END
> END
> 
> (....) 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050811/f25ca10e/attachment.htm>


More information about the MapServer-users mailing list