[OSGeo-Discuss] Call for help: GDAL and txt2shp.py
Steve Lime
Steve.Lime at dnr.state.mn.us
Mon Jul 7 15:05:57 PDT 2008
Shp2img will accept a shapefile as referenced through a mapfile. The mapfile just tells
mapserver how to draw the shapefile (what color, symbol, etc...).
Steve
>>> On 7/7/2008 at 4:03 PM, in message
<2D99077B-8652-425E-9435-665BBB664C54 at hiof.no>, Kjell Are Refsvik
<kjell.a.refsvik at hiof.no> 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.
>
>> My understanding is that you have gps data and you are not sure what
>> coordinate system it is in. You ran Matt Perry's script to convert
>> the text-based coordinates into a shapefile format, but you still
>> need to assign a coordinate system.
>
> I understand. WGS84 and UTM 32V worked fine for the data from Norway.
>
>> ...
>> First, you only need to assign the projection AFTER you run the
>> txt2shp.py script.
>
> OK. I understand.
>
>> ...
>> 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",SPHE
> ROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0
> .017453292519943295]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_o
> f_origin",0],PARAMETER["central_meridian",33],PARAMETER["scale_factor",0.9996
> ],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["Meter
> ",1]]
>> You can check for yourself by downloading a world borders shapefile
> (http://thematicmapping.org/downloads/world_borders.php
>> ) and a world UTM zone shapefile
> (http://earth-info.nga.mil/GandG/coordsys/gislayers/zips/mgrs6x8.zip
>> ), both in the WGS 84/EPSG 4326 coordinate system.
>>
>> If you have more GPS data from other countries I highly recommend
>> getting familiar with UTM zones.
>
> No. Only have data from Norway and Lebanon so far, but looking more
> closely into UTM seems like a good idea, especially in order to to get
> to grips with paper maps.
>
> http://www.ia-stud.hiof.no/~kjellare/misc/lebanon_wgs84_UTM36N.png
>
>> ...
>> If you try to load data in different coordinate systems into the
>> same QGIS project, QGIS will not (by default) make an effort to
>> 'reproject-on-the-fly' when rendering, unless you explicitly set the
>> Qgis project to do so. So even if you assign the correct UTM zone to
>> your points, if you open them in Qgis along with a base layer in WGS
>> 84 projection, they will not line up. You need to go to SETTINGS >
>> PROJECT PROPERTIES > PROJECTION > ENABLE ON THE FLY PROJECTION.
>
> I figured that out, playing around with the Projection settings.
>
>> 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.
>
>> Then, if the assumed source projection was correct, your new
>> shapefile should line up with other data in WGS 84.
>
>> ...
>> 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
>
>> 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.
>
>> Dane
>
> Any idea on the complexity in getting the above scripting to work?
>
> Sincerely,
>
> Kjell Are Refsvik
> Norway
More information about the Discuss
mailing list