Hi,

 

First of all, thank you for Mapserver and all of the documentation. It’s
really a great product.

 

I’m having some performance issues when querying on a column in MapScript.

 

I use the following code:

 

$oResult = @$oLayerObject->queryByAttributes($strField, $strSearchString,
MS_SINGLE);

 

Where $strField can for instance be “Point_ID” and $strSearchString can be
something like “HEG1” . I only need one result, as the column is the primary
key for the table, and is unique. 

 

The tables I’m searching through is of MapInfo *.tab format, has about
50’000 records, and the actual columns are indexed.

 

Each lookup with PHP MapScript takes about 1.5 seconds. I’ve uploaded the
data into a PostGIS-database, and I can find the actual record in about 0.03
seconds.

 

My mapfile definition of the layers looks like this:

 

LAYER

                               NAME Traseer

                               PROJECTION

                                  "init=epsg:32632"

                               END

                               GROUP TelMe

                               METADATA

                                               "wfs_title"
"Traseer"

                                               "wfs_srs"
"EPSG:32632"

                                               "gml_featureid"
"Trace_ID"

                                               "gml_include_items"
"Trace_ID,Type"

                               END

                               TYPE LINE

                               CONNECTIONTYPE OGR

                               CONNECTION "TM_Nett/TM_Traces.TAB"

                               STYLEITEM "AUTO"

                               maxscaledenom 300000

                               TEMPLATE "ttt_query.html"

                               DUMP TRUE

                               CLASS

                                               NAME "Traseer"

                                                               SYMBOL
"default-circle"

                                                               COLOR 255 0 0

                                                               #SIZE 6

                               END

                END # Layer

 

 

LAYER

                               NAME Punkter

                               GROUP TelMe

                               METADATA

                                               "wfs_title"
"Punkter"

                                               "wfs_srs"
"EPSG:32632"

                                               "gml_featureid"
"Point_ID"

                                               "gml_include_items"    "all"

                                               "gml_exclude_items"
"rowid#"

                                               "wms_title"
"Punkter"

                                               "wms_srs"
"EPSG:32632"

                               END

                               PROJECTION

                                  "init=epsg:32632"

                               END

                               DUMP TRUE

                               TYPE POINT

                               CONNECTIONTYPE OGR

                               CONNECTION "TM_Nett/TM_Points.TAB"

                               CLASSITEM "Type"

                               CLASS

                                               maxscaledenom 1000

                                               TEMPLATE "ttt_query.html"

                                               EXPRESSION "TRASE SPLIT"

                                               NAME "Trasedeling"

                                               STYLE

                                                 SYMBOL 'circle' 

                                                 SIZE 8

                                                 COLOR -1 -1 -1 #Usynlig

                                               END

                               END

                               CLASS

                                               maxscaledenom 3000

                                               TEMPLATE "ttt_query.html"

                                               EXPRESSION /NEXANS WTC*/

                                               NAME "WTC-Bokser"

                                               STYLE

                                                 SYMBOL 'square'

                                                 SIZE 12

                                                 COLOR 255 128 0 #Orange

                                                               OUTLINECOLOR
0 0 0

                                               END

                               END

                               CLASS

                                               maxscaledenom 10000

                                               TEMPLATE "ttt_query.html"

                                               EXPRESSION /NODE*/

                                               NAME "Node"

                                               STYLE

                                                 SYMBOL 'house'

                                                 SIZE 16

                                                 COLOR 255 128 0 #Orange

                                                               OUTLINECOLOR
0 0 0

                                               END

                               END

                               CLASS

                                               maxscaledenom 1000

                                               TEMPLATE "ttt_query.html"

                                               NAME "TelMe_Punkter"

                                               STYLE

                                                 SYMBOL 'circle' 

                                                 SIZE 6

                                                 COLOR 255 128 0 #ORANGE

                                                               OUTLINECOLOR
0 0 0

                                               END

                               END

                END # Layer

 

My question would be: Why is MapScript not taking the advantage of the
existing index on the MapInfo *.tab files, and takes 50 times longer than
the PostGIS queries?

 

Thanks in advance,

Håkon

 

 

 

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

Reply via email to