19 January 2011

Yesterday, I found out the easiest way convert polyline Z to poline.
The tool is ogr2ogr, with option '-nlt'
example cmd: 
ogr2ogr -f "ESRI Shapefile" -nlt "LINESTRING" Your_Output_polyline.shp Your_Input_polylineZ.shp

ogr  is cool!!

Xiaoyu Guan (Sam)

06 January 2011

shp2pgsql cmd tool has been used for two years. This week I found that PostGIS release new tool shp2pgsql GUI.
This tool is much easy for beginner to import shapefile to PostGIS. 
Especially, when you want to import shapefile with options.
Such as if you want to import ë á, you have to use -W "LATIN1" function.

01 January 2011

How to convert excel data into pgsql
      1.       Save excel data into csv
1.1   Change column name xcoord= long, ycoord = lat
1.2   Sperator coma(,)
2.       Convert csv to shapefiles.
2.1   Create dbf file via commad( ogr2ogr –f "ESRI Shapefile" OUTPUT.shp INPUT.csv)
2.2   Create shapefile via command ( ogr2ogr –f "ESRI Shapefile" OUTPUT.shp INPUT.vrt)
Sample code:
  <OGRVRTLayer name="test">
    <SrcDataSource relativeToVRT="1">F:\temp\sam\testcsv</SrcDataSource>
    <GeometryField encoding="PointFromColumns" x="long" y="lat"/>
3. convert shape to sql via shp2pgsql
With this ogr2ogr libray, who need ESRI arcgis?!?!

Xiaoyu Guan (Sam)