[mapserver-users] MapScript WMS request

Mr. Puneet Kishor punk.kish at gmail.com
Thu Sep 8 20:40:32 EDT 2011


On Sep 8, 2011, at 7:16 PM, Mr. Puneet Kishor wrote:

> 
> 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&amp;service=WMS&amp;request=GetLegendGraphic&amp;layer=gmna&amp;format=image/png&amp;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=#
> 
> 


I should have also added the following

macromap=# SELECT ST_AsText(the_geom) FROM gmna LIMIT 1;
MULTIPOLYGON(((170.095660072181 65.6251237164987,170.158707739831 65.6269635224645,170.173265447057 65.6291258974802,170.2497277762 65.6357072803021,170.257074956711 65.6372005203368,170.267729454865 65.6409199441452,170.283323865029 65.6476938262634,170.301827075555 65.657286936117,170.370058904075 65.6852127397289,170.394158265237 65.6971816353387,170.45719236517 65.7228758026517,170.477794791157 65.7331303689249,170.501440218163 65.7431659781412,170.506165498289 65.745957239196,170.509550359131 65.74948784687,170.517163313193 65.7692852345393,170.523452830315 65.7856156337451,170.527911709329 65.7872471861488,170.564509940928 65.8002968138894,170.605805308438 65.815184809157,17....


As you can see, everything is in lat/lng.



More information about the mapserver-users mailing list