[mapserver-users] Getting an image scaled to pixels
Stuart
reachstuart at yahoo.com.au
Thu Mar 8 16:32:52 PST 2012
Hi,
I have a csharp application using map_script that I am using to cut up
an ECW file into tiles for display on a Bing map. The issue I am
having is that each tile slightly overlaps others above and below it.
The procedure I am using is as follows:
I load the basic map file below add the projection and units from
within a csharp application:
mapserverMap = new mapObj(mapOutputPath + mapFileName);
mapserverMap.setWKTProjection("+proj=merc +a=6378137 +b=6378137
+lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null
+no_defs ");
mapserverMap.setSize(256, 256);
mapserverMap.units = MS_UNITS.MS_DD ;
I then use the csharp application to add a single RASTER layer
layerObj layer = new layerObj(mapserverMap);
Console.WriteLine(mapserverMap.layerorder);
layer.name = ecwName;
layer.type = MS_LAYER_TYPE.MS_LAYER_RASTER;
layer.status = mapscript.MS_ON;
layer.sizeunits = (int)MS_UNITS.MS_PIXELS;
var extentdoubles = GetPlanExtentFromDB(ecwName, planConnectionString);
layer.setExtent(extentdoubles[0], extentdoubles[1],
extentdoubles[2], extentdoubles[3]);
layer.data = mapOutputPath + ecwName + ".ecw";
I have identified the issue is when for each quadKey I set the
mapserverMap extent to the bounding box of the quadKey MapServer
changes the latitudes of its extent to fit the map size (256 x 256)
e.g. for quadKey 31121320312020 i set the MapServer extent to:
maxX
152.95166015625
maxY
-30.334953881988554
minX
152.9296875
minY
-30.353916372297036
Then after setting the extent if I ask MapServer for its extent it returns:
mapserverMap.extent
{OSGeo.MapServer.rectObj}
maxx: 152.95166015625
maxy: -30.333448799017795
minx: 152.9296875
miny: -30.355421455267795
Notice the Longitudes are the same but the Latitudes (minY, maxY) have
been stretched.
So my question is that when I set mapserverMap object to the bounding
box I want it to be set to the latitude and longitude given and
stretched to fit the map size (256 x 256) rather than MapServer
modifying the latitudes to fit the map size.
Any help would be appreciated.
Stuart
--
Here is the starting map file
MAP
NAME MyMap
DEBUG ON
IMAGECOLOR 128 155 155
UNITS DD
RESOLUTION 96
TRANSPARENT OFF
CONFIG "PROJ_LIB" "/ms4w/proj/nad/"
CONFIG "CPL_DEBUG" "ON"
SYMBOLSET ./etc/symbols.sym
IMAGETYPE png
FONTSET ./etc/fonts.txt
END
More information about the MapServer-users
mailing list