[gdal-dev] Specifying projections
Even Rouault
even.rouault at mines-paris.org
Wed Jun 10 18:03:13 EDT 2009
Le Wednesday 10 June 2009 23:49:41 Nicholas Efremov-Kendall, vous avez écrit :
> Hi Even,
>
> quick question. If it did specify the projection, where would it put it in
> the GML file, somewhere up top I assume?
No, as an attribue of the geometry of each GML feature. Like:
<gml:featureMember>
<ogr:treesa fid="F0">
<ogr:geometryProperty><gml:Polygon
srsName="EPSG:4326"><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-6.754960765902467,61.462188720136709,0 -6.725221386036736,61.467224120527298,0 -6.717138042674094,61.466640471845658,0 -6.714249363124878,61.465167998701141,0 -6.712054958560202,61.464054107099599,0 -6.722721328835235,61.448833465009891,0 -6.717527141760513,61.44786071720717,0 -6.691915741121932,61.451583861738371,0 -6.688499203014175,61.432971953779557,0 -6.691221466314431,61.428195952803037,0 -6.67719387077716,61.424083709150736,0 -6.675108661952891,61.421752929121453,0 -6.674973716921698,61.396820067793584,0 -6.67549919143255,61.394943236738904,0 -6.680054893638072,61.39797210636781,0 -6.685304870828134,61.398056029707639,0 -6.690804710451204,61.394943236738918,0 -6.698471298393201,61.401027678877519,0 -6.711026897688839,61.405582427412632,0 -6.722554912763314,61.408164977461439,0 -6.747249355402857,61.413696288496546,0 -6.759582748688274,61.421443938642952,0 -6.765647640368627,61.432029723554969,0 -6.765647640368627,61.432029723554969,0 -6.763303508862606,61.434410094648705,0 -6.763248195840077,61.452518462568435,0 -6.763248195840077,61.452518462568435,0 -6.76228212366118,61.454818725019614,0 -6.76228212366118,61.454818725019614,0 -6.754960765902467,61.462188720136709,0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>
<ogr:id>5</ogr:id>
<ogr:f_code>EC030</ogr:f_code>
<ogr:dmt>0</ogr:dmt>
<ogr:exs>0</ogr:exs>
<ogr:nam>UNK</ogr:nam>
<ogr:pht>0</ogr:pht>
<ogr:veg>24</ogr:veg>
<ogr:tile_id>1</ogr:tile_id>
<ogr:fac_id>54</ogr:fac_id>
</ogr:treesa>
</gml:featureMember>
>
> On Wed, Jun 10, 2009 at 5:21 PM, Nicholas Efremov-Kendall <
>
> n.e.kendall at gmail.com> wrote:
> > Thanks Evan!
> >
> >
> > On Wed, Jun 10, 2009 at 5:19 PM, Even Rouault <
> >
> > even.rouault at mines-paris.org> wrote:
> >> Nicholas,
> >>
> >> this is a actually a good point. I've just improved ogr2ogr (svn trunk
> >> r17229)
> >> so that it sets the spatial coordinate system on each individual
> >> geometry when -a_srs is specified, in addition to the destination layer.
> >> This way the 'srsName' attribute will be written for each output GML
> >> geometry.
> >>
> >> With your current version of OGR, you can use the following workaround.
> >> Instead of using -a_srs, you can specify both -s_srs and -t_srs, so that
> >> a reprojection (that won't do anything) occurs, which sets the
> >> destination SRS
> >> on each geometry.
> >>
> >> ogr2ogr -f GML -s_srs EPSG:XXXX -t_srs EPSG:XXXX out.gml in.shp
> >>
> >> Other point to be aware of : the GML driver doesn't support reading the
> >> coordinate system. It will just ignore the srsName attribute on a
> >> feature.
> >>
> >> Best regards,
> >>
> >> Even
> >>
> >> Le Wednesday 10 June 2009 22:39:20 Nicholas Efremov-Kendall, vous avez
> >>
> >> écrit :
> >> > Hi all,
> >> >
> >> > I apologize for the somewhat beginner's question but here goes: I'm
> >>
> >> trying
> >>
> >> > to convert a shp file to GML. The shp file doesn't have a projection
> >> > defined for it, and I use the -a_srs" "EPSG:XXXX" -fileout -filein
> >>
> >> format.
> >>
> >> > When I convert them this way, the gml doesn't contain a bounding box
> >> > or information on the projection, although I explicitly assign a
> >> > coordinate system (or think I am). Does anyone have any suggestions on
> >> > why this is happening, and what I can do to resolve this issue?
More information about the gdal-dev
mailing list