0

I have run into a little problem when using MapServer to render complex data statements. To keep this post short and simple, I think the output of shp2img is the best place to start. When I use shp2img with a simple DATA statement (ex: GEOMETRY FROM FOO_TABLE USING SRID 4326) AND the -all_debug 5 flag set - an msOracleSpatialLayerNextShape line is written to the console for every single row.

When I use a more complex DATA statement (see below) - shp2img writes out about a dozen of the msOracleSpatialLayerNextShape line - AND THEN the last line is "Fetched 1234 more rows".... It does not loop through every row like above. When I run the sql that shp2img uses to retrieve the data - it is right on the money. Both shp2img and SQLDeveloper report the same # results.

Is there some reason why shp2img doesn't loop all the results?

Also, this only seems to be an issue with LINE geometry type. The same type of data statements work as expected with POINT.

Complex Data Statement:

DATA "GEOMETRY FROM (SELECT CASE WHEN F.ch_v_avg_a_min IS NULL THEN 0 WHEN F.ch_v_avg_a_min > 242 THEN 1 WHEN F.ch_v_avg_a_min < 242 THEN 2 ELSE 0 END as THRESHOLDCLASS, N.SHAPE AS GEOMETRY FROM CHN_DIS_NODE_MONTH_FACT F INNER JOIN GIS_NETWORK_FEATURE N ON N.OBJECTGUID = F.NODE_FEATUREID WHERE N.NETWORKELEMENTID = 2 and F.MONTHID = TO_DATE('2014-05-01', 'YYYY-MM-DD') AND N.SHAPE IS NOT NULL) USING NONE"
0

I eventually found the cause (and solution) to this problem, and wanted to share them in case someone ran into a similar situation. In my sql snippet included in my original post, you can see that I am attempting to filter out null geometries (N.SHAPE IS NOT NULL). Eventually I found that the table had geometries that were not truly null, but had no coordinates, srid...etc - don't ask me how they got in there like that - I am far away from the load processing... Using the SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT function, I was able to identify these jacked geometries - set them to true null values, and then everything worked as expected. Hope this helps someone else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.