You could also write a fairly simple python script using the gdal/ogr
python modules.

        -----Original Message-----
        From: mapserver-users-boun...@lists.osgeo.org
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mohammed
Rashad
        Sent: Tuesday, April 28, 2009 12:17 PM
        To: mapserver-users@lists.osgeo.org
        Subject: [mapserver-users] RE: Finding Lat-Long from shp file
        
        
        Hi,
        
        Here is the way you can find lat-long values from shp files. The
method is ugly.
        I used this method to select lat-long values from a shape file
consisting of about 150 records. Using this method all lat-long values
from a shapefile consisting of place names of country can be selected
and saved into files.
        I already told method is dirty.
        
        You can find using postgreSQL. first you should install
postgis-postgresql package.
        and follow instructions in postgis manual. 
        you want to import some files after installing postgis such as
lwpostgis.sql etc...
        
        I think you added necessary attributes in shape files such as
name of place etc,..
        
        create a database in postgresql with postgis enabled (say db1)
        Now import .shp files into postgresql using cmd:
        
        you should have a database db1 with postgis support.
        shp2pgsql /root/vect1.shp vect1 db1 > /root/vect1.sql 
        
        now you got vect1.sql file
        
        import sql file into postgresql.
        psql -d db1 -f /root/vect1.sql
        
        Now logon to postgresql admin tool such as phppgadmin or you can
do these thing from postgresql interactive terminal.
        
        In the database db1 now you have another table name vect1.
        vect1 has some other attributes such as gid,the_geom etc..
other than attributes you have entered.   'the_geom' is the geometry of
shape file.
        
        select X(the_geom) from vect1; query executes to display
longitude all entries in shape files 
        
        and
        
        select Y(the_geom) from vect1; query executes to display
latitude all entries in shape files
        
        
        this data can also be inserted into table by inserting a new
column for latitude and longitude.
        
        If you want table back to shp files using the cmd:
        pgsql2shp -f vect1 -p 5432 db1 vect1
        
        Or 
        
        You can also export column  latitude and longtiude into mysql
also as you wish
        
        
        -- 
        Regards,
        Mohammed Rashad K.M
        http://keralainfo.web4all.in/
        +919605476742
        

_______________________________________________
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to