[Mapserver-users] Addtional info/questions about "Another question about DGN attribute query"

Frank Warmerdam warmerdam at pobox.com
Wed Jan 28 11:29:35 EST 2004

Emil Zegers wrote:
> Hello Frank,
> I've tested the DGN file with ogrinfo as you advised, I've included parts of the outcome in this message.
> To me it seems that it is not possible to query the MSLink attribute in a DGN file with Mapserver 4.0 (win binary), can you tell me if I am correct on this?
> Also, I had doubts on what attribute name was the right one to query exactly.
> If I look at the DGN file in Arcexplorer the link attributes are called 'MsLinkOracle' and 'MsLinkOracle 1'.


Arcexplorer expands the DGN information somewhat differently, and arguably in a
better way.  OGR currently only supports one "linkage" per element, discarding any
others.  The EntityNum value can be used to determine something about the type of

> When using ogrinfo it is called 'MSLink''.
> I then found I could use the 'MSLink' values as Lableitem in Mapserver so I can show the MSLink values on a map image.
> But my ultimate goal is to be able to query them so I can get the underlying attribute data from the database (of course I could put all spatial and attribute data together in one database but I would like to have the DGN item query working for situations where it is not possible to do so).
> ogrinfo outcome for GROENNAALDWIJK.DGN
> 1.
> ogrinfo -ro -al GROENNAALDWIJK.DGN -where 'Text is not null' | more
> using driver `DGN' successful.
> Isn't it strange that I don't get any records here? Because there are elements where text is not null (see 2.). Could this have something to do with the unkown geometry (see3.) And if so, can this be solved or worked around?

This is strange.  Any chance you are on windows and that different quoting rules
apply?  Perhaps you should use double quotes around the where clause?

> 3.
> ogrinfo -ro -al GROENNAALDWIJK.DGN -summary
> using driver `DGN' successful.
> Layer name: elements
> Geometry: Unknown (any)
> Feature Count: 25538
> Extent: (72794.312000, 443434.460000) - (75347.808000, 447314.550000)
> Layer SRS WKT:
> (unknown)
> Type: Integer (2.0)
> Level: Integer (2.0)
> GraphicGroup: Integer (4.0)
> ColorIndex: Integer (3.0)
> Weight: Integer (2.0)
> Style: Integer (1.0)
> EntityNum: Integer (8.0)
> MSLink: Integer (10.0)
> Text: String (0.0)
> So I can use Text and MSLink as label items (have not yet tested any others) 
 > for every layertype but whatever layertype I choose I can never query them.

Text and MSLink should be normal variables, and should be queriable in the
usual MapServer fashion.  I don't know why they wouldn't be.

However, your general interest is apparently to actually join the oracle
attrbibutes corresponding to the MSLink value in question.  This is a somewhat
involved process.  However, if you have OGR built with Oracle support you should,
in theory, be able to construct an query with a join that would give you what you

Very roughly, something like:

   -sql 'select * from elements left join 'OCI:userid/password at oci_id'.subtable on subtable.id = elements.MSLink'

This is a pretty complicated action ... I wouldn't suggest you attempt it unless
you are brave and willing to fiddle quite a bit ... including rebuilding things
from the latest source.

> I hope this info is helpful and maybe you or anybody else can provide some more info on DGN item query with Mapserver.
> A thought that just popped in my mind; is DGN item query possible in Mapserver through the FME Gateway?

Yes, this should be possible.  If you have FMEObjects installed on your system
and FME_HOME set when you build, then FMEObjects support should get built into
OGR.  Then you would prepend the filename with the name of the FME reader
you want to use.



However, all things considered, if you have FME handy I would suggest doing
a batch translation to shapefile in a form more convenient for use in MapServer.

Best regards,

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the mapserver-users mailing list