[gdal-dev] Converting contour lines (Shape files) into DEM
Kishore Reddy
enigma2006.kishore at gmail.com
Wed Apr 7 06:39:13 EDT 2010
I must be doing something terribly wrong I guess. Heres is the output.
>> ogrinfo -al Contour_100.shp | grep Extent
Extent: (1966324.986729, 399608.866986) - (2146704.003923, 551765.272646)
>> ogr2ogr -clipsrc 1966328 399612 1984324 404608 clipped.shp
Contour_100.shp
>> ogrinfo -al clipped.shp | grep Extent
Extent: (0.000000, 0.000000) - (0.000000, 0.000000)
Some more details of the input file:
>> ogrinfo -al Contour_100.shp | head -25
INFO: Open of `Contour_100.shp'
using driver `ESRI Shapefile' successful.
Layer name: Contour_100
Geometry: Line String
Feature Count: 1760
Extent: (1966324.986729, 399608.866986) - (2146704.003923, 551765.272646)
Layer SRS WKT:
PROJCS["NAD_1983_StatePlane_North_Carolina_FIPS_3200_Feet",
GEOGCS["GCS_North_American_1983",
DATUM["North_American_Datum_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Lambert_Conformal_Conic_2SP"],
PARAMETER["False_Easting",2000000.002616666],
PARAMETER["False_Northing",0.0],
PARAMETER["Central_Meridian",-79.0],
PARAMETER["Standard_Parallel_1",34.33333333333334],
PARAMETER["Standard_Parallel_2",36.16666666666666],
PARAMETER["Latitude_Of_Origin",33.75],
UNIT["Foot_US",0.3048006096012192]]
Elevation: Integer (4.0)
TILE: String (8.0)
Interval: Integer (4.0)
Please correct me where am I going wrong.
--
Kishore
On Tue, Apr 6, 2010 at 9:43 PM, Chaitanya kumar CH
<chaitanya.ch at gmail.com>wrote:
> Kishore,
>
> You can adjust the geotiff's dimensions and extents from within the script.
> Then use the -te option in gdal_rasterize to limit the extents of the vector
> data.
>
> Other way is to create parts of the shape file using ogr2ogr with the
> option -clipsrc (http://gdal.org/ogr2ogr.html).
>
>
> On Tue, Apr 6, 2010 at 12:00 AM, Kishore Reddy <
> enigma2006.kishore at gmail.com> wrote:
>
>> Hi,
>>
>> I tried the above procedure. Its working. I am giving input as Shapefile
>> and taking geotiff file as output. But the output file is loosing many
>> details as it has been converted at high resolution. Is there any way that
>> I can convert Shapefles into tiles at appropriate resolution so that I can
>> produce many geotiff files for the same Shapefile?
>>
>> --
>> Kishore
>>
>>
>>
>> On Sun, Mar 28, 2010 at 3:37 AM, Even Rouault <
>> even.rouault at mines-paris.org> wrote:
>>
>>> Kishore,
>>>
>>> Here is a process you could try:
>>>
>>> 1) Prepare an output GDAL file for gdal_rasterize.
>>>
>>> You can take care inspiration of
>>>
>>> http://trac.osgeo.org/gdal/wiki/FAQRaster#HowcanIcreateablankrasterbasedonavectorfilesextentsforusewithgdal_rasterizeGDAL1.8.0
>>>
>>> Modify it to create 1 band (instead of 4) and for step 3) to work, you
>>> should
>>> take care of setting a nodata value on the output file and initialize the
>>> raster with it:
>>>
>>> dst_ds.GetRasterBand(1).SetRasterNoDataValue(0)
>>> dst_ds.GetRasterBand(1).Fill(0)
>>>
>>> (if you can compile GDAL from source, you can avoid this step by grabbing
>>> the
>>> latest sources that have an enhanced version of gdal_rasterize, directly
>>> able
>>> to create the output file . See http://trac.osgeo.org/gdal/ticket/3505)
>>>
>>> 2) Use gdal_rasterize to burn the contour lines.
>>>
>>> See http://gdal.org/gdal_rasterize.html
>>>
>>> 3) Fill the holes (the nodata values) with gdal_fillnodata.py.
>>>
>>> See http://gdal.org/gdal_fillnodata.html
>>>
>>> Now, the result should be usable with gdaldem.
>>>
>>> Best regards,
>>>
>>> Even
>>>
>>> Le Saturday 27 March 2010 19:09:06 Kishore Reddy, vous avez écrit :
>>> > Hi everyone,
>>> >
>>> > I am planing to use gdaldem to create relief shaded maps. But the
>>> > problem is gdaldem takes only DEM files as input. Unfortunately I have
>>> > contour lines (in the form of Shape files). So is there any way
>>> > (command line) to convert these shape files into DEM files?
>>> >
>>> > --
>>> > Kishore
>>> > _______________________________________________
>>> > gdal-dev mailing list
>>> > gdal-dev at lists.osgeo.org
>>> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>>
>>>
>>
>> _______________________________________________
>> 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-9848167848
> 17.2416N 80.1426E
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100407/0c93e588/attachment.html
More information about the gdal-dev
mailing list