New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clustering: WMS GetFeatureInfo "n-1" problem #4666

Closed
geekdenz opened this Issue Jun 11, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@geekdenz

geekdenz commented Jun 11, 2013

PHP MapScript - $layerObj->getShape($layerObj->getResult($i)) inconsistent with $layerObj->getNumResults()

Installed from latest source as of now.

When using PHP MapScript and querying a layerObj for its shape with its result when $i is smaller than $layerObj->getNumResults() and greater or equal to 0 the last record is empty.

There is code similar to this:

// ...
$numResults = $layerObj->getNumResults();
for ($i=0; $i < $numResults;$i++){
    $s = $oLayer->getShape($oLayer->getResult($i));
    print_r($s->values);
}

yields:

Array
(
    [site_id] => SB07671
    [Cluster:FeatureCount] => 
)
Array
(
    [site_id] => 
    [Cluster:FeatureCount] => 2
)

This seems to happen at least for clustering.

I suspect it's a problem in MapScript and/or the clustering within MapServer.

We need this fixed asap (of course). Please get in contact if you think you can potentially fix this or help us do so. I am struggling with how to setup MapServer so that I can debug the PHP extension and MapServer itself while it's running within Apache.

I will try more things in the next couple of days and will keep you posted if I find out anything.

If you help resolve this, there is an opportunity for us to consult you on behalf of the company.

@geekdenz

This comment has been minimized.

Show comment
Hide comment
@geekdenz

geekdenz Jun 12, 2013

This bug is actually more fundamental than this! It seems to also be a bug in MapServer 6.2.1, 6.2.0 and maybe even earlier version. This

http://proxy.zen.landcareresearch.co.nz/pn-maps/cgi-bin/mapserv?map=/opt/mapserver/mapfiles/nsd.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=1665581.290608,5650058.569841,1781469.022384,5684454.471966&SRS=EPSG:2193&WIDTH=657&HEIGHT=195&LAYERS=NSD_Layers&STYLES=&FORMAT=image/png&TRANSPARENT=true&QUERY_LAYERS=NSD_Layers&INFO_FORMAT=text/plain&X=216&Y=52&FEATURE_COUNT=4

OUTPUT:

GetFeatureInfo results:

Layer 'NSD_Layers'
  Feature 1241: 
    site_id = 'SB09908'
    Cluster:FeatureCount = ''
  Feature 1242: 
    site_id = 'SB09909'
    Cluster:FeatureCount = ''
  Feature 1243: 
    site_id = 'SB09910'
    Cluster:FeatureCount = ''
  Feature 1240: 
    site_id = ''
    Cluster:FeatureCount = '4'

is an example of the bug using WMS GetFeatureInfo requests. The running version there is 6.2.0 of MapServer. I'm surprised this bug is not a bigger issue since WMS GetFeatureInfo is a widely used way of requesting feature information (as the name implies).

I will have a deeper look into the source code and see if I can find the cause, but at least I know it's not necessarily MapScript.

geekdenz commented Jun 12, 2013

This bug is actually more fundamental than this! It seems to also be a bug in MapServer 6.2.1, 6.2.0 and maybe even earlier version. This

http://proxy.zen.landcareresearch.co.nz/pn-maps/cgi-bin/mapserv?map=/opt/mapserver/mapfiles/nsd.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=1665581.290608,5650058.569841,1781469.022384,5684454.471966&SRS=EPSG:2193&WIDTH=657&HEIGHT=195&LAYERS=NSD_Layers&STYLES=&FORMAT=image/png&TRANSPARENT=true&QUERY_LAYERS=NSD_Layers&INFO_FORMAT=text/plain&X=216&Y=52&FEATURE_COUNT=4

OUTPUT:

GetFeatureInfo results:

Layer 'NSD_Layers'
  Feature 1241: 
    site_id = 'SB09908'
    Cluster:FeatureCount = ''
  Feature 1242: 
    site_id = 'SB09909'
    Cluster:FeatureCount = ''
  Feature 1243: 
    site_id = 'SB09910'
    Cluster:FeatureCount = ''
  Feature 1240: 
    site_id = ''
    Cluster:FeatureCount = '4'

is an example of the bug using WMS GetFeatureInfo requests. The running version there is 6.2.0 of MapServer. I'm surprised this bug is not a bigger issue since WMS GetFeatureInfo is a widely used way of requesting feature information (as the name implies).

I will have a deeper look into the source code and see if I can find the cause, but at least I know it's not necessarily MapScript.

@dmorissette

This comment has been minimized.

Show comment
Hide comment
@dmorissette

dmorissette Jun 12, 2013

Contributor

The reason why it was not found before may be that it is related to clustering which is a relatively new feature.

@szekerest: do you have an idea?

Contributor

dmorissette commented Jun 12, 2013

The reason why it was not found before may be that it is related to clustering which is a relatively new feature.

@szekerest: do you have an idea?

@szekerest

This comment has been minimized.

Show comment
Hide comment
@szekerest

szekerest Jun 12, 2013

Member

If I understand correctly the problem is that we get only 4 results with GetFeatureInfo while we have more results with GetMap within the same view. Could you provide your test data to inspect the problem in detail?

Member

szekerest commented Jun 12, 2013

If I understand correctly the problem is that we get only 4 results with GetFeatureInfo while we have more results with GetMap within the same view. Could you provide your test data to inspect the problem in detail?

@geekdenz

This comment has been minimized.

Show comment
Hide comment
@geekdenz

geekdenz Jun 12, 2013

No, the problem is that we get 4 records while the last record doesn't have data. Feature 1240 has an empty site_id as you should be able to see in the above. The second post is a different request.

Unfortunately, it would be far from trivial to send the "test" data because it is real data. I would have to ask permission, because the data might be private.

Constructing test data is probably as time-consuming as it is to fix it myself. But since it seems to be a bug within MapServer I'm raising it here. Any ideas could help since I'm pretty comfortable with C but am new to MapServer development.

geekdenz commented Jun 12, 2013

No, the problem is that we get 4 records while the last record doesn't have data. Feature 1240 has an empty site_id as you should be able to see in the above. The second post is a different request.

Unfortunately, it would be far from trivial to send the "test" data because it is real data. I would have to ask permission, because the data might be private.

Constructing test data is probably as time-consuming as it is to fix it myself. But since it seems to be a bug within MapServer I'm raising it here. Any ideas could help since I'm pretty comfortable with C but am new to MapServer development.

geekdenz added a commit to geekdenz/mapserver that referenced this issue Jun 14, 2013

Fixes Issue: #4666
Please check reasoning behind this code to ensure we're not
introducing another bug.

  NOTE:
!EQUAL(base->shape.values[i], "")
  should change to
EQUAL(base->shape.values[i], "")
  but becomes a noop!

geekdenz added a commit to geekdenz/mapserver that referenced this issue Jun 14, 2013

Fixes Issue: #4666
  NOTE:
!EQUAL(base->shape.values[i], "")
  should change to
EQUAL(base->shape.values[i], "")
  but becomes a noop!

Please check reasoning behind this code to ensure we're not
introducing another bug.

@szekerest szekerest closed this Jan 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment