[Mapserver-users] Deriving TIGER extents

Stephen Woodbridge woodbri at swoodbridge.com
Thu May 20 08:34:23 EDT 2004


Tiger files from the census do not have any extents info in them. You 
would have to figure that out for each file. I think it would be easier 
to do this with shapefiles. You can convert the files using ogr2ogr. The 
shapefile format contains the file extents and that is set when the file 
is made by scanning all the object put into the file. Also Tiger2shape 
would do the same thing when you create shapefiles.


Marvin Humphrey wrote:

> Greetings,
> My ultimate goal is to generate a few thousand maps via offline batch 
> processing, using TIGER data.  I don't need to set up a production 
> server, so performance isn't an issue at this time and I'm not worried 
> yet about converting to shapefile format for improved speed.
> Unfortunately, I can't even get one TIGER file to display. I managed to 
> grok GRASS, so I *ought* to be able to figure this out.  But I'm stuck. 
>  It seems that I have some sort of extents problem. Maybe I just have my 
> numbers wrong, but if so, I'm not sure how to correct them or to ensure 
> that I get them correct in the future.
> To start with, I downloaded a random county in Michigan and hacked up a 
> bare-minimum .map file (see below).  Then I set up a LAYER according to 
> the instructions at: http://mapserver.gis.umn.edu/doc36/ogr-howto.html
> According to http://mapserver.gis.umn.edu/doc40/mapfile-reference.html 
> Mapserver will attempt to derive the extents of a map if none are 
> specified in the .map file. However, when I tried to omit the extents 
> from the .map file, the browser displayed this error message:
>  msCalculateScale(): General error message. Invalid image extent.
>  msCalculateScale(): General error message. Invalid image extent.
>  mapserv(): Web application error. No way to generate map extent.
> Can it be that TIGER files have no extents data in them? Skimming the 
> technical spec of the TIGER format didn't reveal anything obvious 
> (http://www.census.gov/geo/www/tiger/tiger2002/tgr2002.pdf).  So how do 
> people actually use them?  Does the tiger2shape utility figure out what 
> the most extreme elements are in the file and define the extents that 
> way?  Is there some sort of auxiliary data repository at www.census.gov 
> that I have yet to uncover? Trial and error?
> What would be great is if I could find a utility like ogrinfo that can 
> print the extents to STDOUT.  Then I could grep the output to snag only 
> what I need and autogenerate a bunch of map files using Perl.  It seems 
> like ogrinfo ought to do what I need.  The ogrinfo manpage has an 
> example from an NTF file illustrating typical output
> % ogrinfo -ro -where 'GLOBAL_LINK_ID=185878' wrk/SHETLAND_ISLANDS.NTF 
> BL2000_LINK
> using driver `UK .NTF' successful.
> Layer name: BL2000_LINK
> Geometry: Line String
> Feature Count: 1
> Extent: (419794.100000, 1069031.000000) - (419927.900000, 1069153.500000)
> ...
> Additionally, the manpage indicates that with the -q flag enabled, the 
> output will include extents:
>        -q:
>            Quiet verbose reporting of various information, including
>            coordinate system, layer schema, extents, and feature count.
> Unfortunately, when I run ogrinfo specifying any one layer of the TIGER 
> datasource and -q, I get a torrent of output, which seems to include 
> coordinates for each individual element in the datasource... but no 
> summary data.  When I run with the -summary option, all I get is a 
> couple line breaks then the layer name:
> # ogrinfo -ro -q -summary TGR26049 CompleteChain
> Layer name: CompleteChain
> (FWIW, I am specifying the directory holding all the related files and 
> not an individual TIGER file, so I'm not being bitten by that bug.)
> And when I run ogrinfo with just the -ro flag -- (read-only, otherwise I 
> get an error saying ERROR 4: Tiger Driver doesn't support update. Had to 
> open data source read-only.) -- all I get is a list of layers.  No extents.
> # ogrinfo -ro TGR26049
> INFO: Open of `TGR26049'
> using driver `TIGER' successful.
> 1: CompleteChain (Line String)
> 2: AltName (None)
> 3: FeatureIds (None)
> 4: ZipCodes (None)
> 5: Landmarks (Point)
> 6: AreaLandmarks (None)
> 7: Polygon (None)
> 8: PolygonCorrections (None)
> 9: EntityNames (Point)
> 10: PolygonEconomic (None)
> 11: IDHistory (None)
> 12: PolyChainLink (None)
> 13: PIP (Point)
> 14: TLIDRange (None)
> 15: ZeroCellID (None)
> 16: OverUnder (None)
> 17: ZipPlus4 (None)
> Stymied!  Very well, I thought, before I write to the list I'll try to 
> get one county to display -- then I'll inquire about tools which I can 
> use to derive extents automatically.  I'll hack away at the file until I 
> get something to display... Nope, nothing doing!
> I read in a few archived emails that the extent must be specified in the 
> same units as the datasource.  In the case of TIGER, that's apparently 
> decimal degrees (according to 
> http://www.census.gov/geo/www/tiger/tigermap.html#TOWN ). Since I'm not 
> sure which county in Michigan I downloaded, I entered LatLong for the 
> entire state. Even if the county was small, the CompleteChain layer 
> ought to be visible.  But the map was solid white.
> Eventually I know I will need to get into joining multiple counties in a 
> con mapfile, but for now, I'd just like to get a single file to display.
> Any suggestions?
> -- Marvin Humphrey
> SIZE           400 300
> SHAPEPATH      "data"
> FONTSET        "fonts/fonts.list"
> SYMBOLSET      "symbols/symbols35.sym"
> # Start of LAYER DEFINITIONS ---------------------------------------------
> EXTENT -91 41 -81 48
> #Longitude: 82° 26' W to 90° 31' W
> #Latitude: 41° 41' N to 47° 30' N
>     NAME "tigertest"
>     TYPE line
>     CONNECTION "../TGR26049"
>     DATA "CompleteChain"
> END # end of map file
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users

More information about the mapserver-users mailing list