[MAPSERVER-USERS] Using OGR to plot x, y data from MySQL with Attribute Data

Ben Madin ben at remoteinformation.com.au
Sat May 31 20:14:50 EDT 2008


I think you need to have a look at classitem and class definitions in  
the documentation. With PostGIS you would bring the attribute back  
with your points, make the attribute the classitem and match it in  
each of three classes, one with red colour, one with blue colour and  
one with green colour.

I anticipate that OGR can do the same thing?

cheers

Ben




On 01/06/2008, at 12:00 AM, mapserver-users-request at lists.osgeo.org  
wrote:

> From: fastturtle <beckjoh at KNOLOGY.NET>
> Date: 31 May 2008 11:33:43 AM
> To: mapserver-users at lists.osgeo.org
> Subject: [MAPSERVER-USERS] Using OGR to plot x,y data from MySQL  
> with Attribute Data
>
>
>
> Hi!
>
> I am new user to MapServer and I think I have a simple task.
> I have a MySQL table called data1 with x,y (Lat, Long) data stored  
> in two
> fields and attribute data stored in another field called SPECIFIC.   
> The
> SPECIFIC field has three values that can be an option for a point  
> (bad,
> good, excellent).
>
> I have successfully used OGR to plot my points using the following  
> code,
> however I cannot find an example of how to map the points based on the
> attribute in the SPECIFIC fields. I really need to color
> code the points by the attibute field.  For example, I would color all
> points with a bad rating as red, good as blue and excellent as  
> green.  How
> can I alter my code in the map file to accomplish this task?
>
> <OGRVRTDataSource>
>    <OGRVRTLayer name="data">
>
> < 
> SrcDataSource 
> >MYSQL:test,user=user,password=password,port=3306,tables=data1</ 
> SrcDataSource>
>        <SrcSQL>SELECT * FROM data1</SrcSQL>
>        <GeometryType>wkbPoint</GeometryType>
>        <GeometryField encoding="PointFromColumns" x="Long" y="Lat"/>
>    </OGRVRTLayer>
> </OGRVRTDataSource>
>
> #
>  # Start of layer definitions
>  #
>
>  LAYER
>    NAME "MyAqui"
>    STATUS DEFAULT
>    TYPE POINT
>    CONNECTIONTYPE OGR
>    CONNECTION "aquidata.ovf"
>    DATA "data"
>    CLASS
>       NAME "MyClass"
>           STYLE
>               SYMBOL 'circle'
>               SIZE 15
>               COLOR 0 255 0
>           END
>    END
> END
>
>
> Thanks so much for any help in advance.

-- 

Ben Madin
REMOTE INFORMATION

t : +61 8 9192 5455
f : +61 8 9192 5535
m : 0448 887 220
Broome   WA   6725

ben at remoteinformation.com.au



							Out here, it pays to know...


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080601/ce3b30c5/attachment.html


More information about the mapserver-users mailing list