GDAL projection data from shapefile to raster?

Bradley Mclain bradleym06 at HOTMAIL.COM
Fri Feb 2 01:13:18 EST 2007


Is there anyway I can add projection data from a shapefile to a raster image 
using gdal ultilities? (or any other ways of doing it would be helpful as 
well)

I believe that the raster image has no projection data at all, I tried using 
gdalwarp but couldn't work out how to do it. My main problem is I need the 
raster image to line up with the shapefile and specifying the projections in 
the mapfile does not work. I decided to try and give the raster image its 
own projection data which is the same as the shapefiles, so hopefully they 
will line up correctly.

I have attached the data readout from both so you can look at them.

Brad




>From: "Simpson" <drewsimpson at bellsouth.net>
>To: "Bradley Mclain" 
><bradleym06 at HOTMAIL.COM>,<MAPSERVER-USERS at LISTS.UMN.EDU>
>Subject: RE: [UMN_MAPSERVER-USERS] Projections
>Date: Thu, 1 Feb 2007 07:08:15 -0600
>
>Brad,
>
>A Clarification, did you try epsg 20255 and 20355 for the raster, leaving
>vector at 28355?
>
>Drew.
>
>-----Original Message-----
>From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
>Behalf Of Bradley Mclain
>Sent: Wednesday, January 31, 2007 8:00 PM
>To: MAPSERVER-USERS at LISTS.UMN.EDU
>Subject: Re: [UMN_MAPSERVER-USERS] Projections
>
>
>Hi Jérôme
>
>I tried what you said but still no luck, I tried several combinations, like
>only for raster, only for polygons, and everything together including
>defining in the mapfile. The map still shows but it is still off centre.
>
>I attached the mapfile and a pic of the problem to give you a better idea.
>
>I talked to someone before about this and they said the problem was
>something to do with the fact the shapfile data takes into account the
>spherical nature of the globe while the raster image does not.
>
>Brad
>
>
>
>
> >From: Jérôme Martin <gooogle at FREE.FR>
> >Reply-To: Jérôme Martin <gooogle at FREE.FR>
> >To: MAPSERVER-USERS at LISTS.UMN.EDU
> >Subject: Re: [UMN_MAPSERVER-USERS] Projections
> >Date: Thu, 1 Feb 2007 02:23:35 +0100
> >
> >Hi Bradley,
> >
> >it is normal if your raster is not correctly aligned with the 2 goods
> >shapefiles.
> >
> >In fact, yours shapefiles are on the projection "GDA_1994_MGA_Zone_55", 
>so
> >its implique mapserv knows where to place correctly the shapefiles data.
> >But for your raster, you don't have any information about the projection.
> >So it can't know in what projection and zone the data has to be. (a
> >bounding box exist in each zone, and are just translated from 6° (maybe 
>not
> >in your reprojection, i don't know it, but UTM is the same system of 2x60
> >zones to define the earth)).
> >
> >So you can first try to put for each layer in your mapfile
> >
> >PROJECTION
> >       "init=epsg:xxxx"  #where xxxx is the corresponding identifier of 
>the
> >projection (check the share/proj/epsg file to do this) : in your case, it
> >is "init=epsg:28355".
> >END
> >
> >to force mapserv to know from where the data comes. It is probably useful
> >only for the raster, but try to put again for shapefile in case of it 
>still
> >doesn't work. (It always better to add this information in each layer)
> >
> >I hope i could help you,
> >
> >sincerely,
> >
> >Jérôme
> >
> >Bradley Mclain a écrit :
> >>Hi
> >>
> >>I'm having some problems with projections in Mapserver. I have three
> >>pieces of data, 2 polygon shapefiles and a GeoTIFF raster image. I am
> >>trying to define their projections so that they align correctly as the
> >>raster is slightly off from the two shapefiles.
> >>
> >>I have managed to extract the geographical info from the files but I 
>have
> >>no idea where I define it in the mapfile and what info I need to include
> >>(or what any of it means).
> >>
> >>I have attached the three text files which include the geographical data
> >>for each, can someone explain to me how to define these in a mapfile, eg
> >>where I need to do it and what info I need.
> >>
> >>Can you please include lots of detail and description so I can fully
> >>understand :)
> >>
> >>Thanks
> >>
> >>Brad
> >>
> >>_________________________________________________________________
> >>Advertisement: Fresh jobs daily. Stop waiting for the newspaper. Search
> >>Now! www.seek.com.au
> >>http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau&
>_t=757263760&_r=Hotmail_EndText_Dec06&_m=EXT
> >>
> >>Layer name: DBW_Home_Bilbul_Cadastral_Boundary
> >>Geometry: Polygon
> >>Feature Count: 15
> >>Extent: (419320.137222, 6205167.425465) - (421949.715102, 
>6207719.690811)
> >>Layer SRS WKT:
> >>PROJCS["GDA_1994_MGA_Zone_55",
> >>    GEOGCS["GCS_GDA_1994",
> >>        DATUM["Geocentric_Datum_of_Australia_1994",
> >>            SPHEROID["GRS_1980",6378137.0,298.257222101]],
> >>        PRIMEM["Greenwich",0.0],
> >>        UNIT["Degree",0.0174532925199433]],
> >>    PROJECTION["Transverse_Mercator"],
> >>    PARAMETER["False_Easting",500000.0],
> >>    PARAMETER["False_Northing",10000000.0],
> >>    PARAMETER["Central_Meridian",147.0],
> >>    PARAMETER["Scale_Factor",0.9996],
> >>    PARAMETER["Latitude_Of_Origin",0.0],
> >>    UNIT["Meter",1.0]]
> >>LUID: Real (11.0)
> >>PLANTYPE: String (4.0)
> >>TAG: String (50.0)
> >>Area: Real (19.11)
> >>Perimeter: Real (19.11)
> >>Acres: Real (19.11)
> >>Hectares: Real (19.11)
> >>Bound_type: String (25.0)
> >>Prop_ID: String (30.0)
> >>OGRFeature(DBW_Home_Bilbul_Cadastral_Boundary):0
> >>  LUID (Real) =   103663790
> >>  PLANTYPE (String) = 13
> >>  TAG (String) = 116//751728
> >>  Area (Real) =  206766.29741414590
> >>  Perimeter (Real) =    1930.52158953932
> >>  Acres (Real) =      51.09308655258
> >>  Hectares (Real) =      20.67662974141
> >>  Bound_type (String) = Cadastre
> >>  Prop_ID (String) = DBW_Home_Bilbul
> >>  POLYGON ((419849.019570303731598
> >>6205435.040179193019867,419680.452153401391115
> >>6205707.173638857901096,420228.545299204241019
> >>6206046.107636354863644,420397.849921675398946
> >>6205772.639121992513537,419849.019570303731598 6205435.040179193019867))
> >>
> >>Layer name: DBW_Hemley_2593_Cadastral_Boundary
> >>Geometry: Polygon
> >>Feature Count: 3
> >>Extent: (422645.120770, 6208302.281805) - (423450.690420, 
>6208880.746240)
> >>Layer SRS WKT:
> >>PROJCS["GDA_1994_MGA_Zone_55",
> >>    GEOGCS["GCS_GDA_1994",
> >>        DATUM["Geocentric_Datum_of_Australia_1994",
> >>            SPHEROID["GRS_1980",6378137.0,298.257222101]],
> >>        PRIMEM["Greenwich",0.0],
> >>        UNIT["Degree",0.0174532925199433]],
> >>    PROJECTION["Transverse_Mercator"],
> >>    PARAMETER["False_Easting",500000.0],
> >>    PARAMETER["False_Northing",10000000.0],
> >>    PARAMETER["Central_Meridian",147.0],
> >>    PARAMETER["Scale_Factor",0.9996],
> >>    PARAMETER["Latitude_Of_Origin",0.0],
> >>    UNIT["Meter",1.0]]
> >>LUID: Real (11.0)
> >>PLANTYPE: String (4.0)
> >>TAG: String (50.0)
> >>Area: Real (19.11)
> >>Perimeter: Real (19.11)
> >>Acres: Real (19.11)
> >>Hectares: Real (19.11)
> >>Bound_type: String (40.0)
> >>Prop_ID: String (30.0)
> >>OGRFeature(DBW_Hemley_2593_Cadastral_Boundary):0
> >>  LUID (Real) =   103664166
> >>  PLANTYPE (String) = 13
> >>  TAG (String) = 288//751728
> >>  Area (Real) =   73981.56105988749
> >>  Perimeter (Real) =    1173.94681513112
> >>  Acres (Real) =      18.28124965142
> >>  Hectares (Real) =       7.39815610599
> >>  Bound_type (String) = Cadastre
> >>  Prop_ID (String) = Hemley_2593
> >>  POLYGON ((423067.736698167922441
> >>6208782.058439230546355,423228.702213083277456
> >>6208880.746239688247442,423450.690419794409536
> >>6208521.27053206320852,423266.332749532884918
> >>6208468.748745977878571,423260.736078957444988
> >>6208477.574468746781349,423067.736698167922441 6208782.058439230546355))
> >>
> >>Driver: GTiff/GeoTIFF
> >>Size is 9530, 6552
> >>Coordinate System is `'
> >>Origin = (418485.188000000023749,6208828.519999999552965)
> >>Pixel Size = (0.609681177000000,-0.609608973000000)
> >>Metadata:
> >>  AREA_OR_POINT=Area
> >>  TIFFTAG_SOFTWARE=IMAGINE TIFF Support
> >>Copyright 1991 - 1999 by ERDAS, Inc. All Rights Reserved
> >>@(#)$RCSfile: etif.c $ $Revision: 1.9.1.2 $ $Date: 2001/12/05 00:33:12Z 
>$
> >>  TIFFTAG_XRESOLUTION=1
> >>  TIFFTAG_YRESOLUTION=1
> >>  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
> >>Corner Coordinates:
> >>Upper Left  (  418485.188, 6208828.520)
> >>Lower Left  (  418485.188, 6204834.362)
> >>Upper Right (  424295.450, 6208828.520)
> >>Lower Right (  424295.450, 6204834.362)
> >>Center      (  421390.319, 6206831.441)
> >>Band 1 Block=9530x1 Type=Byte, ColorInterp=Red
> >>Band 2 Block=9530x1 Type=Byte, ColorInterp=Green
> >>Band 3 Block=9530x1 Type=Byte, ColorInterp=Blue
> >>
>
>_________________________________________________________________
>Advertisement: Fresh jobs daily. Stop waiting for the newspaper. Search 
>now!
>www.seek.com.au
>http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau&_t
>=757263760&_r=Hotmail_EndText_Dec06&_m=EXT
>

_________________________________________________________________
Advertisement: Getting married? Tell us why to WIN @ LetsShop 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fwww%2Eletsshop%2Ecom%2FCompetitions%2FLetsMarry%2Ftabid%2F549%2FDefault%2Easpx&_t=751480117&_r=HM_tagline_letsshop_wedding&_m=EXT
-------------- next part --------------
Driver: GTiff/GeoTIFF
Size is 9530, 6552
Coordinate System is `'
Origin = (418485.188000000023749,6208828.519999999552965)
Pixel Size = (0.609681177000000,-0.609608973000000)
Metadata:
  AREA_OR_POINT=Area
  TIFFTAG_SOFTWARE=IMAGINE TIFF Support
Copyright 1991 - 1999 by ERDAS, Inc. All Rights Reserved
@(#)$RCSfile: etif.c $ $Revision: 1.9.1.2 $ $Date: 2001/12/05 00:33:12Z $
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
Corner Coordinates:
Upper Left  (  418485.188, 6208828.520)
Lower Left  (  418485.188, 6204834.362)
Upper Right (  424295.450, 6208828.520)
Lower Right (  424295.450, 6204834.362)
Center      (  421390.319, 6206831.441)
Band 1 Block=9530x1 Type=Byte, ColorInterp=Red
Band 2 Block=9530x1 Type=Byte, ColorInterp=Green
Band 3 Block=9530x1 Type=Byte, ColorInterp=Blue

-------------- next part --------------
Layer name: DBW_Home_Bilbul_Cadastral_Boundary
Geometry: Polygon
Feature Count: 15
Extent: (419320.137222, 6205167.425465) - (421949.715102, 6207719.690811)
Layer SRS WKT:
PROJCS["GDA_1994_MGA_Zone_55",
    GEOGCS["GCS_GDA_1994",
        DATUM["Geocentric_Datum_of_Australia_1994",
            SPHEROID["GRS_1980",6378137.0,298.257222101]],
        PRIMEM["Greenwich",0.0],
        UNIT["Degree",0.0174532925199433]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["False_Easting",500000.0],
    PARAMETER["False_Northing",10000000.0],
    PARAMETER["Central_Meridian",147.0],
    PARAMETER["Scale_Factor",0.9996],
    PARAMETER["Latitude_Of_Origin",0.0],
    UNIT["Meter",1.0]]
LUID: Real (11.0)
PLANTYPE: String (4.0)
TAG: String (50.0)
Area: Real (19.11)
Perimeter: Real (19.11)
Acres: Real (19.11)
Hectares: Real (19.11)
Bound_type: String (25.0)
Prop_ID: String (30.0)
OGRFeature(DBW_Home_Bilbul_Cadastral_Boundary):0
  LUID (Real) =   103663790
  PLANTYPE (String) = 13
  TAG (String) = 116//751728
  Area (Real) =  206766.29741414590
  Perimeter (Real) =    1930.52158953932
  Acres (Real) =      51.09308655258
  Hectares (Real) =      20.67662974141
  Bound_type (String) = Cadastre
  Prop_ID (String) = DBW_Home_Bilbul
  POLYGON ((419849.019570303731598 
6205435.040179193019867,419680.452153401391115 
6205707.173638857901096,420228.545299204241019 
6206046.107636354863644,420397.849921675398946 
6205772.639121992513537,419849.019570303731598 6205435.040179193019867))



More information about the mapserver-users mailing list