[gdal-dev] Labeling rasters

Simon Lyngby Kokkendorff silyko at gmail.com
Tue May 17 02:45:59 EDT 2011


Hi Jerl,

  If you have python with matplotlib and the gdal bindings installed, you
can use gdal to read the DEM (which I assume you are getting gdal_contour to
draw contours from), and then matplotlibs contour-function to draw the
labelled contours. You can draw  on top of an imported map/image-file. I
know that matplotlib will read at least png's, and I think also other image
formats (with the right packages installed).

 Cheers,
 Simon


On Mon, May 16, 2011 at 10:08 PM, Jerl Simpson <jsimpson at wxtrends.com>wrote:

> Ok, thank you.
>
> Does anyone else have any suggestions?
>
>
>
> On Mon, May 16, 2011 at 3:06 PM, Chaitanya kumar CH
> <chaitanya.ch at gmail.com> wrote:
> > Jerl,
> >
> > I'm afraid gdal_rasterize can't do the labelling. You will need a
> > specialized renderer for that. I'm not familiar with any of the desktop
> > applications that do this. Perhaps, qgis has a plugin.
> >
> > On Tue, May 17, 2011 at 1:30 AM, Jerl Simpson <jsimpson at wxtrends.com>
> wrote:
> >>
> >> I already have the resultant image, it looks great.   Just drawing
> >> lines on a map.  I'm using a blank image so I can more clearly see
> >> what's going on.  It's just a black and white image, and that's all I
> >> want.
> >> I'm trying to get the contour labeled, so I know which one I'm
> >> viewing.  So on the 1000 contour, I should see 1000 on the line
> >> somewhere, and if it's a 547 contour, I should see 547 on the line
> >> somewhere.
> >>
> >> Is that possible?
> >>
> >> Thanks,
> >>
> >> Jerl
> >>
> >> On Mon, May 16, 2011 at 2:41 PM, Chaitanya kumar CH
> >> <chaitanya.ch at gmail.com> wrote:
> >> > Jerl,
> >> >
> >> > The contour attribute and the Z values are same here. Just one of them
> >> > is
> >> > enough.
> >> >
> >> > With the Z values near the magnitude of 1000, the burn value of 255 is
> >> > not
> >> > going to make much of a difference. Use it if you want to offset any
> >> > negative Z values.
> >> >
> >> > You should mention contour.shp instead of just 'contour' for
> >> > <src_datasource>.
> >> >
> >> > Make sure BLANK.tif doesn't have different extents/projection.
> >> >
> >> > Your final image will have a data type of Float64. You may have to run
> >> > some
> >> > contrast stretching operations on it.
> >> >
> >> > On Tue, May 17, 2011 at 12:04 AM, Jerl Simpson <jsimpson at wxtrends.com
> >
> >> > wrote:
> >> >>
> >> >> Hi guys and gals:
> >> >>
> >> >> I have something that's evading me.  I have a basic ESRI Shape file
> >> >> (created using gdal_contour) that I run through gdal_rasterize to
> >> >> generate very nice looking contour map.  But I want the value of the
> >> >> contour in there.
> >> >>
> >> >> I've been trying different things with the -a option, but I can't get
> >> >> it to work out.
> >> >> Here's the latest thing I've tried for gdal_rasterize:
> >> >>
> >> >> gdal_rasterize -a contour -3d -b 1 -b 2 -b 3 -b 4 -burn 255 -burn 255
> >> >> -burn 255 -burn 255 -burn 255 -l contour contour BLANK.tif
> >> >>
> >> >> I put an extra burn value in there (have also tried with out) to see
> >> >> if maybe it was just going in as 0.  BLANK.tif is just a black image.
> >> >> I'm sure I'm missing something simple, just can't see it.  I thought
> >> >> the -a would burn the value of "contour" into the raster.
> >> >>
> >> >> Thanks for any guidance!!
> >> >>
> >> >> Here's the data from my shapefile:
> >> >>
> >> >> INFO: Open of `contour/'
> >> >>      using driver `ESRI Shapefile' successful.
> >> >>
> >> >> Layer name: contour
> >> >> Geometry: 3D Line String
> >> >> Feature Count: 157
> >> >> Extent: (-0.500000, -89.830132) - (359.500000, 89.144137)
> >> >> Layer SRS WKT:
> >> >> GEOGCS["GCS_WGS_1984",
> >> >>    DATUM["WGS_1984",
> >> >>        SPHEROID["WGS_1984",6378137,298.257223563]],
> >> >>    PRIMEM["Greenwich",0],
> >> >>    UNIT["Degree",0.017453292519943295]]
> >> >> ID: Integer (8.0)
> >> >> contour: Real (12.3)
> >> >> OGRFeature(contour):0
> >> >>  ID (Integer) = 0
> >> >>  contour (Real) =     1000.000
> >> >>  LINESTRING (87.765060240963862 80.0 1000,.....
> >> >> _______________________________________________
> >> >> gdal-dev mailing list
> >> >> gdal-dev at lists.osgeo.org
> >> >> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> >> >
> >> >
> >> >
> >> > --
> >> > Best regards,
> >> > Chaitanya kumar CH.
> >> > /tʃaɪθənjə/ /kʊmɑr/
> >> > +91-9494447584
> >> > 17.2416N 80.1426E
> >> >
> >>
> >>
> >>
> >> --
> >> This communication is privileged and may contain confidential
> >> information.  It's intended only for the use of the person or entity
> >> named above. If you are not the intended recipient, do not distribute
> >> or copy this communication. If you have received this communication in
> >> error, please notify the sender immediately and return the original to
> >> the email address above. © Copyright 2011 Weather Trends
> >> International, Inc.
> >
> >
> >
> > --
> > Best regards,
> > Chaitanya kumar CH.
> > /tʃaɪθənjə/ /kʊmɑr/
> > +91-9494447584
> > 17.2416N 80.1426E
> >
>
>
>
> --
> This communication is privileged and may contain confidential
> information.  It's intended only for the use of the person or entity
> named above. If you are not the intended recipient, do not distribute
> or copy this communication. If you have received this communication in
> error, please notify the sender immediately and return the original to
> the email address above. © Copyright 2011 Weather Trends
> International, Inc.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110517/6b23d886/attachment.html


More information about the gdal-dev mailing list