[mapserver-users] Tileindex of DGN files

Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi
Fri Oct 16 03:54:48 EDT 2009


Hi,

Tileindex is as the name suggests, index of tiles.  I guess that in the
beginning of history tiles meant image files which are often devided
side by side to suit mapsheets, but ogrtileindex can utilise the same
mechanism with vector files as well.  Tileindex holds the extents of
individual image or vector files which are to be used together.  When
Mapserver knows that there is a tileindex it starts its work by throwing
a spatial query against tileindex.  Tradionally tileindex itself is a
shapefile, but I have been reading that it can come from database as
well, so I guess it could be some other vector format supported by ogr
also. Anyway, it does not matter if tileindex in using the default
shapefile format because it is only an index that points further to the
real data, in this case .dgn files.

You observed that tileindex has one polygon for each original vector
file it is indexing.  That't exactly how it is made to work.  When
zoomed to some BBOX Mapserver is first sending a spatial query against
tileindex in order to see which indexed rectangles are intersected. Then
Mapserver reads from the "location" field which real vector files it
must open.

The long error message you attached looks to me like the first step is
going OK.  Tileindex is read and Mapserver tries to open one by one the
DGN files whose filenames have captured from the "location" fiels. There
are many trials, so you have obviously zoomed rather far. I do not have
an idea why the next step, actually opening DGN files does not succeed.
The error is "msOGRFileOpen(): OGR error. Open failed for OGR connection
in layer `Trn'". I do not know how Mapserver knows that there is a layer
called "Trn" that it try to open but doesn't this mean that the file is
found but something goes wrong when opening it?  I have never played
with DGN files with Mapserver so I won't do more guessing.

-Jukka Rahkonen-



TA wrote:
 

Dear Frank Warmerdam,

> type line 
> connectiontype OGR 
> tileindex "/MAP/dgnindex.shp" 
> data "elements" 
> filter "where level = 1,2,3" 

   The error caused by this code is long:

msDrawMap(): Image handling error. Failed to draw layer named 'Trn'.
msOGRFileOpen(): OGR error. Open failed for OGR connection in layer
`Trn'.
File not found or unsupported format. msConnPoolRegister(): General
error
message. Missing CONNECTION on layer DGN. msConnPoolRegister(): General
error message. Missing CONNECTION on layer DGN. msConnPoolRegister():
General error message. Missing CONNECTION on layer DGN.
msConnPoolRegister(): General error message. Missing CONNECTION on layer
DGN. msConnPoolRegister(): General error message. Missing CONNECTION on
layer DGN. msConnPoolRegister(): General error message. Missing
CONNECTION
on layer DGN. msConnPoolRegister(): General error message. Missing
CONNECTION on layer DGN. msConnPoolRegister(): General error message.
Missing CONNECTION on layer DGN. msConnPoolRegister(): General error
message. Missing CONNECTION on layer DGN. msConnPoolRegister(): General
error message. Missing CONNECTION on layer DGN. 


>The above should work to select only features from the DGN files with 
>the desired attribute.  Note that this filter will be applied to the 
>files pointed to by dgnindex.shp, not to the tileindex itself. 

  I think so. I found that the .dbf of the tileindex shape file has only
a
field "location" which stores the paths of the datafiles. Since 'data'
and
'filter' work with a single DGN file, so I try to convert the tileindex
shape file to DGN and test whether filter function can be used with
tileindex DGN. I think this makes the attributes would match between
tileindex file and DGN files.

>I'm not clear what you actually did here to get this error.  If you 
>provide an exact commandline I might be able to look into it. 

Here are the commandlines:
c:\ms4w\Apache\cgi-bin\ogrtindex -f "DGN" D:\ms4w\DGN\index.DGN
D:\ms4w\DGN\*.lpn

This gives an error of
> Error 6: CreateField<> not supported by this layer 
> Can't find LOCATION field in tile index dataset.

Since it cannot find LOCATION Field, I try:
c:\ms4w\Apache\cgi-bin\ogrtindex -f "DGN" -tileindex "level"
D:\ms4w\DGN\index1.DGN D:\ms4w\DGN\*.lpn
This gives an error of 
Error 6: CreateField<> not supported by this layer 

The DGN created shows blank squares, which each square should render 1
DGN
map. That means the squares are right in coordinates but it is empty. I
also
try replace "level" with DGN attributes like type, grapchicgroup and
colorindex but same result comes out. 
If replacing with "elements",  this would show > Can't find elements
field
in tile index dataset.> 

>you would use 'TYPE TILEINDEX' if you want to manage the tileindex
itself 
>as a distinct layer.  To the best of my knowledge type tileindex layers

>do not draw.  You would need another TYPE LINE layer that references
the 
>tileindex layer as it's tileindex instead of pointing directly to a
shapefile. 
>This would allow you to apply a filter to the tileindex instead of the 
>underlying files if that is your objective. 

You mean one layer specfies type tileindex and another specfies type
line
with tileindex "layername"?
I have tried the following code:

Layer
	Name "index"
	Type tileindex
	#Connectiontype OGR
	data "/MAP/dgnindex.shp"
END

Layer
	Name "DGN"
	status default
	Type line
	#connectiontype OGR
	tileindex "index"
	styleitem "auto"
	class
		style
			color 255 0 0
		end
	end
END

This gives msTiledSHPOpenFile(): Shapefile error. Unable to open a
single
tile to use as a template in layer LPpipe. msShapefileOpen(): Unable to
access file.(/MAP/xxx.lpn)....
If I use connectiontype OGR, the error would be like the top long
error(msDrawMap(): Image handling error.....). For this method, I have
no
idea about how to connect to and render a index shp file containing DGN.

>The approach at the top should have worked.
You mean the part > tileindex "/MAP/dgnindex.shp" > data "elements"  ?

Best Regards,
TA

-- 
View this message in context:
http://n2.nabble.com/Tileindex-of-DGN-files-tp3820288p3833208.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the mapserver-users mailing list