[gdal-dev] PDF-->JPEG-->KML. Confused about association between
KML bounding box and PDF's neatline and corner coordinates.
Even Rouault
even.rouault at mines-paris.org
Wed Oct 20 13:49:09 EDT 2010
NEATLINE is only a concept of geospatial PDF encoded according to the OGC Best
Practice. Adobe-style have only bbox. That could be turned into a pseudo
neatline I guess.
Le mercredi 20 octobre 2010 19:26:36, Brent Fraser a écrit :
> Hmmm. My PDF doesn't seem to have a neatline, only a MediaBox and two
> BBoxes...
>
> Brent
>
> On 10/20/2010 9:04 AM, Even Rouault wrote:
> > You don't need to convince anyone to add new functionnality. It already
> > exists ;-)
> >
> > See the -cutline option of gdalwarp. Basically you use the NEATLINE
> > reported by gdalinfo as the CUTLINE (that was the sole purpose of
> > reporting the NEATLINE by the way !)
> >
> > The easiest way is to make a simple CSV like this :
> >
> > foo,WKT
> > bla,"POLYGON((....))"
> >
> > and you paste the content of NEATLINE as the value of the WKT.
> >
> > and do a gdalwarp without reprojecting to crop (use -crop_to_cutline) to
> > the neatline. Then you can do a 2nd gdalwarp to reproject to the target
> > SRS.
> >
> > (if you want to do just one gdalwarp, you'll have to do ogr2ogr to
> > reproject the cutline.csv into the target SRS)
> >
> > See http://gdal.org/gdalwarp.html and/or
> > http://gdal.org/structGDALWarpOptions.html#0ed77f9917bb96c7a9aabd73d4d06e
> > 08
> >
> >> Boris,
> >>
> >> Use gdalwarp to convert your jpeg to Geographic coordinates (I think
> >>
> >> it needs to be converted for KML anyways):
> >>
> >> gdalwarp -t_srs EPSG:4326 in.jpg out.jpg
> >>
> >> then use gdalinfo to get the corner coordinates.
> >>
> >> Currently the entire page of the PDF is rendered into the image.
> >> Perhaps we can convince Even to add an option to convert only the mapped
> >> area (or mask everything else?)
> >>
> >> Best Regards,
> >> Brent Fraser
> >>
> >> On 10/20/2010 8:07 AM, Boris Dev wrote:
> >>> My objective is to make a KML ground overlay with a geospatial PDF map.
> >>>
> >>> Using GDAL's translate utility I have converted the PDF to a JPEG. The
> >>> next step and problem for me is to write the text of the KML ground
> >>> overlay, which requires a text of bounding box information like this:
> >>>
> >>> <LatLonBox>
> >>>
> >>> <north>37.91904192681665</north>
> >>> <south>37.46543388598137</south>
> >>> <east>15.35832653742206</east>
> >>> <west>14.60128369746704</west>
> >>>
> >>>
> >>> <rotation>-0.1556640799496235</rotation>
> >>>
> >>> </LatLonBox>
> >>>
> >>> As GDAL's output, I saw that the entire PDF with legend, title, etc
> >>> and not just the map image was converted.
> >>>
> >>> As GDAL's output, I also saw 2 parts of data that seem they are useful
> >>> to match a bounding box to the map within the jpeg, but I cant figure
> >>> out the puzzle of how to make this work? Can I get the bounding box of
> >>> the entire PDF image with this information below?
> >>>
> >>> Corner Coordinates:
> >>> Upper Left ( 666937.758, 2024687.983)
> >>> Lower Left ( 666991.811, 2018338.153)
> >>> Upper Right ( 674511.276, 2024754.795)
> >>> Lower Right ( 674565.328, 2018404.965)
> >>> Center ( 670751.543, 2021546.474)
> >>>
> >>> <MDI key="NEATLINE">POLYGON ((672676.488065659650601
> >>> 2019417.955749646294862,672636.091432046378031
> >>> 2024030.267778463661671,667347.405745737953112
> >>> 2023983.612156898481771,667385.539170471020043
> >>> 2019370.524140953086317,672676.488065659650601
> >>> 2019417.955749646294862,672676.488065659650601
> >>> 2019417.955749646294862,672676.488065659650601
> >>> 2019417.955749646294862,672676.488065659650601
> >>> 2019417.955749646294862))</MDI>
> >>>
> >>> I realize the coordinate above need to be converted to lat/long to be
> >>> a KML ground overlay onto Google Maps, which I think I can handle.
> >>>
> >>> But I am unsure if I need to extract the map image from the jpeg using
> >>> the NEATLINE?
> >>> How are the Corner Coordinates translated into a bounding box?
> >>>
> >>> Any suggestions?
> >>>
> >>>
> >>> _______________________________________________
> >>> gdal-dev mailing list
> >>> gdal-dev at lists.osgeo.org
> >>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list