[OSGeo-Discuss] Call for help: GDAL and txt2shp.py

Dane Springmeyer blake at hailmail.net
Mon Jul 7 14:54:18 PDT 2008


Kjell,


On Jul 7, 2008, at 2:03 PM, Kjell Are Refsvik wrote:

>
> On 7. juli. 2008, at 19.19, Dane Springmeyer wrote:
>
>> Hi Kjell,
>> ...
>> You are not alone. Projected coordinate systems can confuse  
>> beginners and experts alike.
>
> :-)
>
> Well, given my completely newbie status as a GIS/Geodata user, I am  
> very grateful for your patience, explaining these things to me.
>

no problem. Please do consider consulting the mailing lists of the  
specific software that you are using as well.


>> ...
>> Second, I can see now (from your image links) that your data was  
>> collected in Lebanon, which means that the link I directed you to  
>> will not provide a reference to the correct UTM zone.
>>
>> There are two possible UTM zones for Lebanon: UTM 36N or UTM 37N.
>>
>> WGS 84 / UTM zone 36N
>> http://spatialreference.org/ref/epsg/32636/
>>
>> WGS 84 / UTM zone 37N
>> http://spatialreference.org/ref/epsg/32637/
>
> 36N seemed to have done thr trick:
> PROJCS["WGS_1984_UTM_Zone_36N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",33],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter",1]]
>>

great.


>> Or use the command line program ogr2ogr to reproject your shapefile  
>> to WGS84/EPSG 4326 from your assumed UTM projection. That command  
>> would look like:
>>
>> $ ogr2ogr -s_srs EPSG:32636 -t_srs EPSG:4326  
>> lebanon_points_wgs84.shp lebanon_points_utm36N.shp
>
> Splendid. I will have a go at that.
>

Note that if you want to use ogr2ogr like this you can skip the step  
of assigning the projection by manually adding a .prj file. In one  
fell swoop you are telling ogr that the projection is UTM and a given  
zone without requiring ogr2ogr to read the projection information from  
the .prj file.


>> Yes, they are GUI applications... but don't you just need to  
>> automate the processing of your GPS data?
>
> No. In addition to use a unix shell-script to harvest and prepare  
> geodata from my images using exiftool and some basic text formatting  
> commands in unix, I also need to prepare the necessary shapefiles  
> and hopefully find some way of (using shell-scripts) atomatically  
> export png files to make up the map.
>
> A quick sketch (using a screengrabbed OpenStreetMap) here:
> http://www.ia-stud.hiof.no/~kjellare/misc/programming_goal.png
>

Okay. Well that graphic is nice and simple. However, getting there  
through automation will be not be as easy as using Qgis to layout you  
map graphics and then exporting them into another design program like  
Scribus, Inkscape, or the GIMP to do your photo layout.

I'm assuming that you want to do this with desktop based tools. If you  
are up for installing apache then you could utilize a variety of web  
based toolkits to automate the generation of the map graphic and the  
photo layout. I'd look into Openlayers and Geoserver (in addition to  
Mapserver and Mapnik), and any web framework with a powerful  
templating engine like django.


If you want to stick to the desktop Mapserver and Mapnik do have the  
ability to create map graphics on the command line, but it's not as  
simple as automating the conversion of a shapefile to png. You need to  
style and label your shapefile data of points along with basemap data.  
Therefore you will be looking to render multiple layers into a single  
raster png.  Shp2img of the mapserver project or a the use of mapnik  
python bindings will be able to do this without resorting to  
installing and setting up a webserver, but you'll still need to create  
a MAPFILE that defines the styling and labeling.


>> If you want to create one PNG raster then QGIS or uDIG are the  
>> ideal tools to layout your png map. Just open all your shapefiles  
>> (you can even merge them all into one shapefile with ogr2ogr),  
>> label them, then zoom to each group and export a PNG file....
>>
>> If you truly want to automate the creation of  *many* PNG graphics  
>> then you'll need to look into scripting a mapping toolkit like  
>> Mapserver or Mapnik.
>
> Ouch. I see now that what looked like a way out of this (shp2img) is  
> not accepting a shapefile as a input.
>

No, shp2img needs a MAPFILE as input (the mapfile points to your  
shapefile(s) - or other datasources - and tells mapserver how to  
render them):

http://mapserver.gis.umn.edu/docs/reference/utilityreference/shp2img

I'd recommend looking into the QGIS "Export to mapserver" plugin as  
well.

Mapnik can use an XML based MAPFILE, but has no command line utility  
to generate a png from the MAPFILE, but simple script examples can be  
found here:

http://trac.mapnik.org/wiki/XMLGettingStarted#Step2



>> Dane
>
> Any idea on the complexity in getting the above scripting to work?
>

Not too complex, but you will need to read up on how to create a  
MAPFILE.


> Sincerely,
>
> Kjell Are Refsvik
> Norway
>
> _______________________________________________
> Discuss mailing list
> Discuss at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/discuss/attachments/20080707/eb806271/attachment-0002.html>


More information about the Discuss mailing list