[mapserver-users] MapScript WMS request

Mr. Puneet Kishor punk.kish at gmail.com
Thu Sep 8 17:16:33 PDT 2011


On Sep 8, 2011, at 6:52 PM, Daniel Morissette wrote:

> On 11-09-08 07:44 PM, Mr. Puneet Kishor wrote:
>> 
>>> 
>>> 2- Try a GetCapabilities instead of GetMap, and make sure your layer shows up properly and with no WARNING in the GetCapabilities XML output. Make sure the name of the layer is not changed: if you have multiple layers with the same name then the WMS handler will rename them to make them unique (WMS spec requirement)
>> 
>> 
>> That was very useful. No errors, but I do notice the following funky issue (see below)
>> 
>>    <Layer queryable="0" opaque="0" cascaded="0">
>>         <Name>gmna</Name>
>>         <Title>gmna</Title>
>>         <SRS>EPSG:4326</SRS>
>>         <LatLonBoundingBox minx="-2.5e+07" miny="-2.5e+07" maxx="2.5e+07" maxy="2.5e+07" />
>>         <BoundingBox SRS="EPSG:4326"
>>                     minx="-2.5e+07" miny="-2.5e+07" maxx="2.5e+07" maxy="2.5e+07" />
>>         <Style>
>>           <Name>default</Name>
>>           <Title>default</Title>
>>           <LegendURL width="167" height="7029">
>>              <Format>image/png</Format>
>>              <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0&service=WMS&request=GetLegendGraphic&layer=gmna&format=image/png&STYLE=default"/>
>>           </LegendURL>
>>         </Style>
>> 
>> 
>> Where the heck did that (+-)2.5e+07 business get into the BoundingBox? I didn't add that. All I did was query in lat/lon. Maybe that is where my error remains now.
>> 
> 
> What is your data? a Shapefile? What is the source projection of the data?

PostGIS. lat/lng. SRID 4326

> 
> I suspect the BoundingBox is invalid because the layer projection is not set to the right value. Those funky numbers look like values in meters, so presumably your data is in a projected coordinate system.
> 
> In your script you set:
> 	$layerOne->setProjection("init=epsg:4326");

Already have that line in both $mapObj and in the $layerObj

    $map->setProjection("init=epsg:4326");
    ..
    $layerOne->setProjection("init=epsg:4326");


> 
> This will work only if your data is in EPSG:4326. If that's not the case then you need to set the layer projection to match the source data.
> 

punkish at lucknow$/opt/local/lib/postgresql90/bin/psql -U postgres -d macromap
psql (9.0.4)
Type "help" for help.

macromap=# SELECT ST_SRID(the_geom) FROM gmna LIMIT 1;
 st_srid 
---------
    4326
(1 row)

macromap=# SELECT * FROM geometry_columns WHERE f_table_name = 'gmna';
 f_table_catalog | f_table_schema | f_table_name | f_geometry_column | coord_dimension | srid |     type     
-----------------+----------------+--------------+-------------------+-----------------+------+--------------
                 | gmna           | gmna         | the_geom          |               2 | 4326 | MULTIPOLYGON
(1 row)

macromap=#





More information about the MapServer-users mailing list