[mapserver-users] Need help with OGR/DGN

Sara Yurman syurman at spatialfocus.com
Sun Mar 17 13:12:22 EST 2002


I'm trying to use OGR with .dgn files to do something we currently do
with shapefiles: produce images of individual parcels with digital
orthos behind them.  I can get the files to show up with MapServer, but
I can't get useful information from queries to the OGR layer.

My second strategy was to use ogr2ogr to create shapefiles.  I got
shapefiles, but without text strings or anything else that might connect
parcel numbers with locations.

Any suggestions would be deeply appreciated.  I'm truly befuddled.  I've
listed my ogr2ogr string, the OGR layer from my mapfile, and the
mapscript for the query below.

Thanks,

Sara


********************ogr2ogr***************************
I tried a couple things fancier than this, but the
results were identical:

ogr2ogr -f "ESRI Shapefile" 9344 9344.dgn


*******************OGR Layer from mapfile************

LAYER
    NAME "9344"
    TYPE LINE
    CONNECTIONTYPE OGR
    CONNECTION "data/934413.dgn"
    STATUS ON
    STYLEITEM "AUTO"
    CLASSITEM "LEVEL"
    CLASS
          NAME "Parcels"
          EXPRESSION /[0-9]*/
          TEMPLATE DUMMY
    END
END

**********************Mapscript**********************
This lists 276 as the number of results, but the number
of lines is always 0.  The shapeindexes look good,
ranging from 13 through 885.  Tileindex is always -1.

$map = new mapObj( 'my.map' );
$rect = $map->{ 'extent' };
$layer = $map->getLayerByName( '9344' );
$success = $map->queryByRect( $rect );
$rc = $layer->{ 'resultcache' };
$numresults = $rc->{'numresults' };
print $numresults,"\n";
$shape = new shapeObj(-1);
foreach ( 0..( $numresults - 1 ) ){
          $rc_mem = $layer->getResult( $_ );
          $stuff = $layer->getShape( $shape, $rc_mem->{'tileindex'},
$rc_mem->{'shapeindex'} );
          print $shape->{'numlines'},"\n";
}





More information about the mapserver-users mailing list