[mapserver-users] Shapefile features = 0 (zero integer value) are empty and ignored? [SEC=UNCLASSIFIED]

Jeff McKenna jmckenna at gatewaygeomatics.com
Mon Apr 4 09:05:28 PDT 2016


On 2016-04-04 12:33 AM, Inna Nogeste wrote:
> Hi Thomas,
>
> After many attempts using the same expression syntax it finally worked.
> Is there any reason as to why the following expression syntax didn’t
> work the first time?

You could be hitting a weird issue in your DBF file, where your 
attributes are stored.  As I mentioned earlier to you, you could test 
further by using the ogrinfo commandline tool to return the column 
types, and also step through the values, such as:

   ogrinfo myfile.shp myfile |more

That should allow you to step through each value, and note how your zero 
integer values appear to the GDAL/OGR library.

You can also pass your expression directly to the ogrinfo tool, and 
check the response for the correct "feature count" value, such as:

   ogrinfo -where "INT_TEST = 0" myfile.shp myfile -summary

Then you could also change your mapfile layer such as:

   LAYER
     ...
     CONNECTIONTYPE OGR
     CONNECTION "myfile.shp"
     ...
     CLASSITEM "INT_TEST"
     CLASS
       EXPRESSION "0"
       ...
     END #class
   END #layer


You can also do some more testing, by creating a new integer column in 
you DBF, setting a few zero values in it, and then re-testing in 
MapServer through the shp2img command.  Likely you will find an odd 
problem with the old integer column.

-jeff


-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/







More information about the MapServer-users mailing list