Funny units for jpeg images

ender at titan.lab.csuchico.edu ender at titan.lab.csuchico.edu
Tue Aug 1 04:41:22 EDT 2000


Steve, other developers:

  This brings up one of those little things that I've wanted to fix but
haven't gotten around to.  Mapserver really needs to follow the rules for
reading world files.  The rules are: if the extention has three
characters, the world file will be the first and last character of the
extention followed by a 'w'.  For example: image.tif -> image.tfw,
image.gif -> image.gfw, image.jpg -> image.jgw.

  If the extention has more than three characters, the 'w' is appended to
the complete extention: image.tiff -> image.tiffw, image.jpeg ->
image.jpegw.

  If the extention is missing, the 'w' is added to the filename: image ->
imagew.

  I think many of our new users problems stem from the non-standard file
names Mapserver uses.

  Another place where a change could be made is in the mapfile, when you
are specifying the data for a shapefile base feature theme, the mapserver
will not allow you to put the .shp extention on this file.  All other data
types allow the extention, except for the .shp.  This is very easy to
compensate for, so I wonder if there is a reason for this being the way it
is...  If not, I will submit diffs to implement this change.

-Aaron


On Tue, 1 Aug 2000, Mel VanderWal wrote:

> Hey all.
> 
> If you need to create world files in ArcView, Todd Poston recently posted a good
> extension (and the source code) on the ESRI ArcScripts site
> (http://gis.esri.com/arcscripts/details.cfm?CFGRIDKEY=B718A422-5E5A-11D4-943200508B0CB419).
> 
> I only tested it a little, but Todd knows what he's doing, so it's probably solid.
> For MapServer users, use the .apr instead of the extension, so you can change one
> line in the script QDIR.View.WriteWorldFile.Click.  Then georeference your images
> in that apr.
> 
> Change:
> theFN =
> FileName.Merge(theISrc.GetSrcName.GetFileName.ReturnDir.AsString,theISrc.GetSrcName.GetFileName.GetBaseName
> + "w")
> To:
> theFN = theISrc.GetSrcName.GetFileName
> theFN.SetExtension("tfw")
> 
> or else the world file will get a .tifw extension instead of a .tfw extension,
> which is OK in ArcView, but MapServer won't recognize it.  One ArcView world file
> convention is simply to add a "w" to the image's file extension, so that's the way
> many world files are named.  It's probably minor for most MapServer users, but I
> spent awhile figuring out why an image wouldn't georeference.  (Steve: Maybe to
> make using the same data a little easier... - wishlist item?)
> 
> 
> imap at chesapeake.net wrote:
> 
> > Hello, This isnt exactly right...  THe worldfile X/Y is the upper left
> > pixel, not bottom right.  I have found that matching projections is not an
> > exact science.  Sometime you need to adjust the X/Y and map units to stretch
> > the raster to get a tight fit.
> >
> > I have done a couple of these..  You have to begin with PROJ and knowing
> > the precise projection and central meridian.  That should get it close,
> > then you can tweak the map units in the X/Y to shore up the edges.
> >
> > Also, keep in mind that rasters may never match their vector counterparts,
> > due to basemap mismatch and thinning etc.
> >
> > It very well could be, that your JPG is a different projection???
> >
> > I have several *very* nice raster maps here (Mountain High Maps) that I am
> > unable
> > to match the base projection with anything in PROJ.  Since there is no
> > metadata
> > for the images, it requires much guesswork.
> >
> > Regards,
> >
> > Chris Stuber (mapsurfer)
> > Silicon Mapping Solutions, Inc
> >
> > Jason Maestri wrote:
> > >
> > > John,
> > >
> > > I am not sure why your data don't line up. The world file is okay, the only
> > > coordinates that are specified in the esri type world
> > > files are the X and Y of the bottom right corner.  They seem to be really
> > > close to what you think they should be, so I'd imagine
> > > that the world file is not your problem.  Mapserver doen't care what
> > > projection your data are in, so there isn't any place to
> > > specify projections.  I'd use arcview or grass or something to make sure they
> > > really do line up, and further explore the problem.
> > >
> > > --Jason
> > >
> > > John Hockaday wrote:
> > >
> > > > Hi,
> > > >
> > > > I am trying to get a jpeg to load as a background image with vector
> > > > data on top of it.  Both are in geographical coodinates however, when I
> > > > load one on top of the other they seem to be in different projections.
> > > >
> > > > The world file for the jpeg looks like this:
> > > >
> > > > ------------------------
> > > >             0.000450
> > > > 0
> > > > 0
> > > >            -0.000450
> > > > 150.000914
> > > > -33.998391
> > > > ------------------------
> > > >
> > > > The image is supposed to be from TL(150, -34) to BR(151.5, -35).  That
> > > > is 1.5 degrees by 1 degree with the top left corner at 150 degrees long
> > > > and -34 degrees lat.
> > > >
> > > > Am I missing out on specifying a decimal degrees unit for my layers in
> > > > the map file?  The map file is attached.
> > > >
> > > > I would be greatfull for any information if someone else has used
> > > > georeferenced jpegs and vector shapefiles in a geographic coordinate
> > > > system.
> > > >
> > > > Thanks in advance.
> > > >
> > > > John Hockaday
> > > >
> > > >   ------------------------------------------------------------------------
> > > > #
> > > > # Start of map file
> > > > #
> > > > NAME DEMO
> > > > STATUS ON
> > > > SIZE 600 600
> > > > SHADESET /opt/contrib/src/ms_3.3.010/symbols/shade.sym
> > > > MARKERSET /opt/contrib/src/ms_3.3.010/symbols/marker.sym
> > > > LINESET /opt/contrib/src/ms_3.3.010/symbols/line.sym
> > > > EXTENT 149 -35 152 -32
> > > > UNITS dd
> > > > SHAPEPATH "/info/cgi-data/atlas/fornet/"
> > > > IMAGECOLOR 255 255 255
> > > >
> > > > #LABELOVERLAP FALSE
> > > >
> > > > #
> > > > # Start of web interface definition
> > > > #
> > > > WEB
> > > >   #HEADER demo_header.html
> > > >   TEMPLATE demo.html
> > > >   #MINSCALE 1000
> > > >   #MAXSCALE 1550000
> > > > END
> > > >
> > > > #
> > > > # Start of reference map
> > > > #
> > > > #REFERENCE
> > > >   #IMAGE graphics/reference_base.gif
> > > >   #EXTENT 481093.000000 4969319.036682 502271.000000 4997508.3073184
> > > >   #STATUS ON
> > > >   #COLOR -1 -1 -1
> > > >   #OUTLINECOLOR 255 0 0
> > > > #END
> > > >
> > > > #
> > > > # Start of legend
> > > > #
> > > > LEGEND
> > > >   KEYSIZE 18 12
> > > >   LABEL
> > > >     TYPE BITMAP
> > > >     SIZE MEDIUM
> > > >     COLOR 0 0 89
> > > >   END
> > > >   STATUS ON
> > > > END
> > > >
> > > > #
> > > > # Start of scalebar
> > > > #
> > > > SCALEBAR
> > > >   IMAGECOLOR 255 255 255
> > > >   LABEL
> > > >     COLOR 0 0 0
> > > >     SIZE SMALL
> > > >   END
> > > >   SIZE 350 5
> > > >   COLOR 255 255 255
> > > >   BACKGROUNDCOLOR 0 0 0
> > > >   OUTLINECOLOR 0 0 0
> > > >   UNITS kilometers
> > > >   INTERVALS 5
> > > >   STATUS ON
> > > > END
> > > >
> > > > #
> > > > # Start of layer definitions
> > > > #
> > > >
> > > > LAYER
> > > >   NAME coast
> > > >   TYPE POLYGON
> > > >   STATUS DEFAULT
> > > >   DATA coast
> > > >   CLASS
> > > >     SYMBOL 0
> > > >     OUTLINECOLOR 0 0 0
> > > >     COLOR 248 248 95
> > > >   END
> > > > END
> > > >
> > > > LAYER
> > > >   NAME si5609g
> > > >   TYPE RASTER
> > > >   STATUS ON
> > > >   DATA si5609g.jpg
> > > >   OFFSITE 0
> > > > END
> > > >
> > > > LAYER
> > > >   NAME cocos
> > > >   TYPE RASTER
> > > >   STATUS ON
> > > >   DATA cocos.tif
> > > >   OFFSITE 0
> > > > END
> > > >
> > > > LAYER
> > > >   NAME soils
> > > >   TYPE POLYGON
> > > >   STATUS ON
> > > >   DATA soils
> > > >   TOLERANCE 3
> > > >
> > > >   CLASSITEM "symbol"
> > > >   CLASS
> > > >     NAME "Classification by Symbol"
> > > >     EXPRESSION "7"
> > > >     COLOR 204 096 085
> > > >     BACKGROUNDCOLOR 32 201 201
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "27"
> > > >     COLOR 255 255 000
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "33"
> > > >     COLOR 204 191 085
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "37"
> > > >     COLOR 234 223 085
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "52"
> > > >     COLOR 204 223 170
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "62"
> > > >     COLOR 204 159 085
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "98"
> > > >     COLOR 255 255 170
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "146"
> > > >     COLOR 153 159 085
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "158"
> > > >     COLOR 204 159 085
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "177"
> > > >     COLOR 153 064 000
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "200"
> > > >     COLOR 153 128 000
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "202"
> > > >     COLOR 102 159 170
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "212"
> > > >     COLOR 153 128 000
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >   CLASS
> > > >     EXPRESSION "216"
> > > >     COLOR 153 159 000
> > > >     OUTLINECOLOR 0 0 0
> > > >   END
> > > >
> > > >   #QUERYITEM symbol
> > > >   QUERY
> > > >     #EXPRESSION "216"
> > > >     TEMPLATE demo.html
> > > >     #JOIN "data/lakejoin.dbf" islake "type"
> > > >   END
> > > >   #QUERY
> > > >   #EXPRESSION "^-"
> > > >     #TEMPLATE land.html
> > > >     #JOIN "data/lakejoin.dbf" islake "type"
> > > >   #END
> > > > END # Layer
> > > >
> > > > LAYER
> > > >   NAME rne12030
> > > >   TYPE POLYGON
> > > >   STATUS ON
> > > >   DATA rne12030
> > > >   TOLERANCE 5
> > > >
> > > >   CLASS
> > > >     NAME "rne12030"
> > > >     COLOR 49 117 185
> > > >   END
> > > >
> > > >   QUERY
> > > >     TEMPLATE /info/cgi-data/atlas/fornet/rne12030.html
> > > >   END
> > > > END # Layer
> > > >
> > > > LAYER
> > > >   NAME rail
> > > >   TYPE LINE
> > > >   STATUS ON
> > > >   DATA rail
> > > >   SYMBOLSCALE 4
> > > >   CLASS
> > > >     NAME "rail"
> > > >     COLOR 212 212 212
> > > >     SYMBOL 13
> > > >     SIZE 2
> > > >     MAXSIZE 4
> > > >   END
> > > >
> > > >   QUERY
> > > >     TEMPLATE /info/cgi-data/atlas/fornet/rail.html
> > > >   END
> > > > END # Layer
> > > >
> > > > #LAYER
> > > > #  NAME primary_roads
> > > > #  TYPE LINE
> > > > #  STATUS OFF
> > > > #  DATA primary
> > > > #  SYMBOLSCALE 24000
> > > > #
> > > > #  CLASS
> > > > #    NAME "Primary Roads"
> > > > #    COLOR 128 128 128
> > > > #    SYMBOL 13
> > > > #    SIZE 3
> > > > #    MAXSIZE 5
> > > > #  END
> > > > #END # Layer
> > > >
> > > > #LAYER
> > > > #  NAME runways
> > > > #  TYPE LINE
> > > > #  STATUS OFF
> > > > #  DATA runways
> > > > #
> > > > #  CLASS
> > > > #    COLOR 30 94 30
> > > > #    NAME "Airport Runways"
> > > > #  END
> > > > #END # Layer
> > > >
> > > > LAYER
> > > >   NAME "points"
> > > >   TYPE ANNOTATION
> > > >   STATUS ON
> > > >   MAXSCALE 6555555
> > > >   DATA "points"
> > > >   TOLERANCE 10
> > > >
> > > >   LABELITEM "Place_name"
> > > >
> > > >   CLASS
> > > >     SIZE 8
> > > >     COLOR 255 0 0
> > > >     SYMBOL 6
> > > >     LABEL
> > > >       BACKGROUNDCOLOR 200 255 255
> > > >       COLOR 30 94 94
> > > >       TYPE BITMAP
> > > >       #JUSTIFY CENTER
> > > >       SIZE GIANT
> > > >       POSITION AUTO
> > > >       WRAP " "
> > > >     END # Label
> > > >   END # Class
> > > >
> > > >   QUERY
> > > >     TEMPLATE /info/cgi-data/atlas/fornet/points.html
> > > >   END # Query
> > > > END # Layer
> > > >
> > > > END # Map File
> 
> --
> Mel VanderWal
> GIS Programmer / Manager
> GAIA Consultants Inc.
> Suite 306, 822-11th Avenue SW
> Calgary, Alberta
> Canada
> T2R 0E5
> Phone: (403) 571-7216
> Fax: (403) 571-7211
> www.gaiaenv.com
> vanderwalm at gaiaenv.com
> 
> 




More information about the mapserver-users mailing list