Mapserver PostGIS Custom SRID Problem

Paul Moen pmoen at OFFROADSOFTWARE.COM
Tue Jan 29 17:02:53 PST 2008


My own error was causing the problem.  I was editing a mapfile that  
wasn't actually being used.


On Jan 29, 2008, at 5:53 PM, Paul Moen wrote:

> This is my layer.
> LAYER
>        NAME "Montana"
> 		PROJECTION
> 			"init=epsg:1038007"
> 		END
>        CONNECTION "user=postgres dbname=1038007 host=127.0.0.1  
> port=5432"
> 	    CONNECTIONTYPE postgis
> 	    DATA "the_geom from mt_counties using unique gid using  
> SRID=1038007"
>        TYPE POLYGON
>        STATUS ON
>        CLASS
>          NAME "MT counties"
>          STYLE
>            COLOR 245 245 245
>            OUTLINECOLOR 200 200 200
>          END
>        END
>      END
>
> I am using the user postgres for the sql statement .
>
> This is the actual command that I used from the command line.
>
> psql -d 1038007 -U postgres -c "SELECT  
> asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from  
> mt_counties WHERE the_geom && setSRID('BOX3D(1792876.6493994  
> 343910,2160707.3506006 612229)'::BOX3D, 1038007 )"
>
>
> These are all performed on the same server that PostgreSQL is running.
>
>
> I do have the database named 1038007.  Is there a problem with  
> database names being all numerals within PostgreSQL?  Everything  
> seems to work fine except when mapserver is making the call.
>
> On Jan 29, 2008, at 5:33 PM, Paul Ramsey wrote:
>
>> There's something wrong, because the same SQL should return the  
>> same result... there should not be a non-deterministic difference  
>> depending on from where you enter it.  Are you sure you're entering  
>> it in the same database, using the same user, as mapserver is?
>>
>> P
>>
>> Paul Moen wrote:
>>> 1 row equal to 1038007
>>> On Jan 29, 2008, at 3:46 PM, Paul Ramsey wrote:
>>>> what does
>>>>
>>>> SELECT DISTINCT SRID(the_geom) from mt_counties;
>>>>
>>>> return?
>>>>
>>>> what does
>>>>
>>>> SELECT * FROM geometry_columns WHERE f_table_name = 'mt_counties';
>>>>
>>>> return?
>>>>
>>>> Paul Moen wrote:
>>>>> I get the following error when trying to draw a layer that  
>>>>> exists in postgis.
>>>>> [MapServer Error]: msPOSTGISLayerWhichShapes(): Error executing  
>>>>> POSTGIS SQL statement (in FETCH ALL): DECLARE mycursor BINARY  
>>>>> CURSOR FOR SELECT  
>>>>> asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text  
>>>>> from mt_counties WHERE the_geom &&  
>>>>> setSRID('BOX3D(1792876.6493994 343910,2160707.3506006  
>>>>> 612229)'::BOX3D, 1038007 )
>>>>> -ERROR:  Operation on two geometries with different SRIDs
>>>>> If I issue the following sql command in postgis two rows are  
>>>>> returned rather than the error.
>>>>> SELECT  
>>>>> asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text  
>>>>> from mt_counties WHERE the_geom &&  
>>>>> setSRID('BOX3D(1792876.6493994 343910,2160707.3506006  
>>>>> 612229)'::BOX3D, 1038007 )
>>>>> The custom SRID has been added to the spatial_ref_sys table in  
>>>>> postgis and the epsg file in the proj resources.  These layers  
>>>>> display exactly the way I want when viewing with Qgis connected  
>>>>> as postGIS layers.
>>>>> Does anyone have any ideas on what I can do to further  
>>>>> troubleshoot this?  Is this a problem with mapserver, postgis,  
>>>>> or something I am doing?  Version info.
>>>>> Mac OS 10.4.11
>>>>> "POSTGIS="1.2.1" GEOS="3.0.0rc4-CAPI-1.3.3" PROJ="Rel. 4.5.0, 22  
>>>>> Oct 2006" USE_STATS"
>>>>> MapServer Version    MapServer version 4.10.1 OUTPUT=GIF  
>>>>> OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF  
>>>>> OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER  
>>>>> SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT  
>>>>> SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=GEOS  
>>>>> INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE
>>>>> PHP MapScript Version    ($Revision: 1.260.2.1 $ $Date:  
>>>>> 2006/11/22 19:34:45 $)
>>>>> Thanks,
>>>>> Paul
>>>>
>>>>
>>>> -- 
>>>>
>>>> Paul Ramsey
>>>> Refractions Research
>>>> http://www.refractions.net
>>>> pramsey at refractions.net
>>>> Phone: 250-383-3022
>>>> Cell: 250-885-0632
>>
>>
>> -- 
>>
>> Paul Ramsey
>> Refractions Research
>> http://www.refractions.net
>> pramsey at refractions.net
>> Phone: 250-383-3022
>> Cell: 250-885-0632



More information about the MapServer-users mailing list