MySQL and mapfile

Lowell Filak lfilak at MEDINACO.ORG
Tue Apr 5 12:04:50 EDT 2005


The following message was sent by Don Deskins <dldeskins at GMAIL.COM> on
Tue, 5 Apr 2005 10:41:37 -0500.

> Hello,
>
> Again, I am new to mapserver.  I have finally gotten my map to display
> properly but it is very slow, so I am interested in getting all of the
data
> into a database (MySQL).
>
> I have data (in .shp, .dbf, and .shx files) that I have converted using
> mygisimport.  This produce an sql file which I imported into the MySql db.
> I am now having trouble accessing this data with the mapfile.  Here is
what
> I have:
>
>   LAYER
>     NAME "SCAP_Cert2004_ParcelsUTM16M"
>     CONNECTIONTYPE mygis
>     CONNECTION "host:user:password:db:bin:"
>     #geo is the name of the column
>     DATA "geo from Parcels feature"
>     STATUS ON
>     TYPE POLYGON
>     CLASS
>       OUTLINECOLOR 255 0 0
>       TEMPLATE "template.html"
>     END
>     MAXSCALE 40000
>     TOLERANCE 0
>     TOLERANCEUNITS PIXELS
>   END
>
> I get the following error:
>
> Warning: [MapServer Error]: SELECT feature.id, feature.vertices,
> geometry.WKB_GEOMETRY from bad mysql query : bad mysql query in <filepath
> and name> on line 217
>
> Can anyone help with this?
>
> BTW, I tried to use shp2mysql.pl, but got several failures.
>
> Thanks,

Don,

This may be a good time to record a recent run-in I had with
shp2mysql.pl while helping another person, we don't actually use it:

1) If you're using Geo::Shapelib-0.12 you need to change 'ShapeRecords'
to 'Shaperecords' in shp2mysql.pl.

2) If you're using Geo::Shapelib-0.13 you need to leave 'ShapeRecords'
as 'ShapeRecords' but -
Change:
for ($v = 0; $v < $vars; $v++){
to
for $v ( keys %{${$shape->{ShapeRecords}}[0]} ) {
in shp2mysql.pl

As far as improving speed, you have many options available. Have you
searched the archives for tiling & indexing shapefiles yet?

Lowell



More information about the mapserver-users mailing list