Opened 18 years ago
Closed 18 years ago
#1645 closed defect (fixed)
non-square pixels not working correctly
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | MapServer C Library | Version: | 4.8 |
Severity: | normal | Keywords: | |
Cc: | sgillies@… |
Description
I am attempting to include the MapServer as a c library into a seperate C++ program I am using. I am explicitly setting the extent to the exact lat/lon values I want for the images. The extent is shifting from EXTENT -113.981498074503 50.7247102624229 -113.961752952407 50.7319757375771 to EXTENT -113.981498074503 50.7226042699327 -113.961752952407 50.7340817300673 it doesn't matter if I call msSetConfigOption(map, "MS_NONSQUARE", "YES"); the extent changes by the same ammount. If I do set the option for non-square pixels, the resulting image is blank (white which is the background color). Please see the various attactments.
Attachments (4)
Change History (9)
by , 18 years ago
comment:1 by , 18 years ago
Trying to provide as much info as possible. Here is my configure command: ./configure --prefix=/usr/local --with-freetype --with-zlib --without-png --with -jpeg --without-xpm --with-libiconv --with-gd --without-pdf --without-eppl --wit h-proj --with-threads --without-sde --without-mpatrol --without-geos --with-ogr= /usr/local/bin/gdal-config --with-gdal=/usr/local/bin/gdal-config --with-tiff -- without-postgis --without-mygis --without-oraclespatial --without-ming --without -wms --without-wfs --without-wcs --without-wmsclient --without-wfsclient --witho ut-curl-config --without-fastcgi --with-httpd=/usr/local/apache_1.3.29/bin/httpd --without-php Here is my Mapserver compile flags after configure: gcc -c -O2 -fPIC -Wall -DIGNORE_MISSING_DATA -DHAVE_VSNPRINTF -DNEED_STRLCAT -DUSE_PROJ -DUSE_TIFF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_GETBITMAPFONTS -DUSE_OGR -DUSE_GDAL -DUSE_ICONV -DUSE_THREAD -DUSE_ZLIB -I/usr/include -I/usr/local/include mapthread.c -o mapthread.o ar rc libmap.a maptemplate.o mapbits.o maphash.o mapshape.o mapxbase.o mapparser.o maplexer.o maptree.o mapsearch.o mapstring.o mapsymbol.o mapfile.o maplegend.o maputil.o mapscale.o mapquery.o maplabel.o maperror.o mapprimitive.o mapproject.o mapraster.o mapsde.o mapogr.o mappostgis.o mapmygis.o maplayer.o mapresample.o mapwms.o mapwmslayer.o maporaclespatial.o mapgml.o mapprojhack.o mapthread.o mapdraw.o mapgd.o mapoutput.o mapgdal.o mapswf.o mapimagemap.o mapows.o mapwfs.o mapwfslayer.o mapcontext.o maphttp.o mapdrawgdal.o mappdf.o mapjoin.o mapgraticule.o mapcopy.o mapogcfilter.o mapogcsld.o maptime.o mapwcs.o mapcpl.o cgiutil.o maprasterquery.o mapobject.o mapgeos.o classobject.o layerobject.o mapio.o mappool.o mapsvg.o mapregex.o mappluginlayer.o ranlib libmap.a gcc -O2 -fPIC -Wall -DIGNORE_MISSING_DATA -DHAVE_VSNPRINTF -DNEED_STRLCAT -DUSE_PROJ -DUSE_TIFF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_GETBITMAPFONTS -DUSE_OGR -DUSE_GDAL -DUSE_ICONV -DUSE_THREAD -DUSE_ZLIB -I/usr/include -I/usr/local/include shp2img.o -L. -lmap -lgd -L/usr/lib -lgd -ljpeg -lfreetype -lpng -lz -ltiff -ljpeg -lfreetype -lpng -lz -lproj -ljpeg -L/usr/local/lib -lgdal -lpthread -L -lc -lz -lm -lstdc++ -o shp2img I have copied all the -D flags to the makefile I use to compile the attached sample source program.
comment:2 by , 18 years ago
Cc: | added |
---|
comment:4 by , 18 years ago
Status: | new → assigned |
---|
By way of demonstrating simplication, the problem can also be demonstrated with the command: shp2img -m test.map -o out.tif and the file: MAP CONFIG "MS_NONSQUARE" "YES" NAME HELLO EXTENT 0 50 400 300 SIZE 400 300 IMAGECOLOR 200 255 255 IMAGETYPE gtiff LAYER STATUS DEFAULT TYPE LINE FEATURE POINTS 50 50 350 50 350 250 50 250 50 50 END END CLASS COLOR 255 0 0 END END END Setting a valid projection on the map and layer fixes the problem. So the problem is that contrary to my understanding, the NONSQUARE stuff still only works if there is a valid projection available. I shall dig into it from that view point.
comment:5 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The solution seems to be to default layer->project to MS_TRUE when the map is initialized. I have committed this change in 4.9. The workaround in 4.8 is to set a projection on the layer and map. Iterating through the layers manually and setting layer->project to MS_TRUE in advance would also work. I ran my test suite afterwards and it seemed ok. The first pass through drawing the map will reset map->project to MS_FALSE if msProjectionDiffer() is false. I don't feel comfortable with backporting this change back into 4.8.2. It seems like the sort of thing that could cause unexpected problems.
Note:
See TracTickets
for help on using tickets.
Map file