[mapserver-users] draw line using mysql sahpe file

Murat Beyhan beyhan at deprem.gov.tr
Tue Mar 6 23:45:21 PST 2012


Dear All,

For 2 weeks I struggled to draw simple line using mysql database in
order to collect to many lines and draw only desired one on the map I
followed many way but could not solve the problem

at the beginning of my work I stored start and end of the line point on
the database as a table on mysql then I try to draw it using ogr. but I
could not draw it.
Then I firs create shape file of lines than I store it on mysql spatial
database by following 

 ogr2ogr -f MySQL MySQL:testogr,user=root,password=password123
sfault1.shp -nln sfault -append -overwrite -lco GEOMETRY_NAME=SHAPE2
then structure of the table created by this command as follows:


OGR_FID  
int(11)
Yes 
NULL 
SHAPE2  
geometry
Yes 
NULL 
id  
decimal(1,0)
Yes 
NULL 
lon  
double(8,4)
Yes 
NULL 
lat  
double(7,4)
Yes 
NULL 
eq_id  
varchar(14)
Yes 
NULL 

same database testogr has a two another table which collect
geometry_column and spatial_ref_sys.

then I try to draw it on mapserver
then I succeeded but it draws all of the line stored in this table using
following map layer. 
LAYER
     NAME "fault"
     TYPE line
     STATUS default
   CONNECTIONTYPE OGR
   CONNECTION '<OGRVRTDataSource>
   <OGRVRTLayer name="sfault">
<SrcDataSource>MYSQL:testogr,user=root,password=password123,host=localhost,port=3306,tables=sfault</SrcDataSource>
     </OGRVRTLayer>
    </OGRVRTDataSource>' 
 
   DATA sfault
   
  CLASS
  NAME "Kaynak Fay/Source Fault"
   SYMBOL "cline"
   SIZE 3
   COLOR 255 0 0 
 END
 END

But I desire only one of them using eq_id column but when I make sql
statement as follows. I mean when I add sql statement it draws nothing.
But be sure same eq_id comes to map file correctly to draw point of
epicenter. There is no problem for it. Also I use EXPRESSION FOR CLASS
also it doesn't draw line on the map. Previous map draws all, following
draws nothing. How can I pass this handicap. Please let help me.
LAYER
     NAME "fault"
     TYPE line
     STATUS default
   CONNECTIONTYPE OGR
   CONNECTION '<OGRVRTDataSource>
   <OGRVRTLayer name="sfault">
<SrcDataSource>MYSQL:testogr,user=root,password=password123,host=localhost,port=3306,tables=sfault</SrcDataSource>
<SrcSQL>SELECT eq_id from sfault where eq_id like  "%eq_id%" </SrcSQL>
</OGRVRTLayer>
</OGRVRTDataSource>' 

   DATA sfault
#   CLASSITEM "eq_id"
  CLASS
#  EXPRESSION ([eq_id] EQ 'eq_id') !!!!!! this also doesn't work 
   NAME "Kaynak Fay/Source Fault"
   SYMBOL "cline"
   SIZE 3
   COLOR 255 0 0 
END
END


-- 
Murat BEYHAN
Geophysical Engineer, M.Sc.
Prime Ministry
Disaster and Emergency Management Presidency
Earthquake Department
Address: Eskisehir Yolu 12. Km.
Lodumlu/ANKARA
Tel: 312 2872680-1556
email:beyhan at deprem.gov.tr



-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the MapServer-users mailing list