Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have downloaded sources of Qgis 1.8. I would like to know how it accepts mif file. As I have learnt after choosing add VectorLayer. Method addVectorLayers is called. Then openvectorlayer dialog shows. Afterwards QgsVectorLayer is created. It is constructor

QgsVectorLayer::QgsVectorLayer( QString vectorLayerPath,
                                QString baseName,
                                QString providerKey,
                                bool loadDefaultStyleFlag )
    : QgsMapLayer( VectorLayer, baseName, vectorLayerPath )
    , mUpdateThreshold( 0 )     // XXX better default value?
    , mDataProvider( NULL )
    , mProviderKey( providerKey )
    , mEditable( false )
    , mReadOnly( false )
    , mModified( false )
    , mMaxUpdatedIndex( -1 )
    , mActiveCommand( NULL )
    , mRenderer( 0 )
    , mRendererV2( NULL )
    , mUsingRendererV2( false )
    , mLabel( 0 )
    , mLabelOn( false )
    , mVertexMarkerOnlyForSelection( false )
    , mFetching( false )
    , mJoinBuffer( 0 )
    , mDiagramRenderer( 0 )
    , mDiagramLayerSettings( 0 )
{
  mActions = new QgsAttributeAction( this );

  // if we're given a provider type, try to create and bind one to this layer
  if ( ! mProviderKey.isEmpty() )
  {
    setDataProvider( mProviderKey );
  }
  if ( mValid )
  {
    // Always set crs
    setCoordinateSystem();

    QSettings settings;
    //Changed to default to true as of QGIS 1.7
    //TODO: remove hack when http://hub.qgis.org/issues/5170 is fixed
#ifdef ANDROID
    bool use_symbology_ng_default = false;
#else
    bool use_symbology_ng_default = true;
#endif
    if ( settings.value( "/qgis/use_symbology_ng", use_symbology_ng_default ).toBool() && hasGeometryType() )
    {
      // using symbology-ng!
      setUsingRendererV2( true );
    }

    // check if there is a default style / propertysheet defined
    // for this layer and if so apply it
    bool defaultLoadedFlag = false;
    if ( loadDefaultStyleFlag )
    {
      loadDefaultStyle( defaultLoadedFlag );
    }

    // if the default style failed to load or was disabled use some very basic defaults
    if ( !defaultLoadedFlag && hasGeometryType() )
    {
      // add single symbol renderer
      if ( mUsingRendererV2 )
      {
        setRendererV2( QgsFeatureRendererV2::defaultRenderer( geometryType() ) );
      }
      else
      {
        QgsSingleSymbolRenderer *renderer = new QgsSingleSymbolRenderer( geometryType() );
        setRenderer( renderer );
      }
    }

    mJoinBuffer = new QgsVectorLayerJoinBuffer();

    connect( QgsMapLayerRegistry::instance(), SIGNAL( layerWillBeRemoved( QString ) ), this, SLOT( checkJoinLayerRemove( QString ) ) );
    updateFieldMap();

    // Get the update threshold from user settings. We
    // do this only on construction to avoid the penality of
    // fetching this each time the layer is drawn. If the user
    // changes the threshold from the preferences dialog, it will
    // have no effect on existing layers
    // TODO: load this setting somewhere else [MD]
    //QSettings settings;
    //mUpdateThreshold = settings.readNumEntry("Map/updateThreshold", 1000);
  }
} // QgsVectorLayer ctor

So for now I need to know where the data from .mif file is been parsed.

share|improve this question

1 Answer 1

QGIS uses GDAL/OGR to read MIF (and most of the other file based vector data formats). The vector layer just handles things that are independant of a specific data format. The vector data providers handle more specific stuff.

For the MIF case that's not very specific as the OGR provider just calls OGR and that's where the formats are detected and parsed. So from the QGIS side there isn't much difference between MIF and for instance shapefiles, that are both handled via OGR.

MapInfo files are parsed with the MITAB driver in OGR.

share|improve this answer
    
I would like to send map from QGis to my application. My application doesnt use Qgis Api (it uses own api). My application use different structure of data for analysing maps. It can export mif files. So I would like send Map from QGis to my application and then send results of analysis back. –  bossman Jul 7 '12 at 10:10
    
Thats why I choosed mif files –  bossman Jul 7 '12 at 10:11
    
Maybe writing a Sextante plugin would work for you. –  jef Jul 7 '12 at 17:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.