[Qgis-user] Polygon colours in existing shape files.

Pierre Chevalier Géologue pierrechevaliergeol at free.fr
Fri Oct 8 03:28:34 PDT 2010


Anita Graser claviota:
> Whatever format Mapinfo uses to store style information 
Here is an example of a polygon with (horrible) graphical attributes, 
from a .mif file:

Region  1
  27
149046.45 52513.21
149238.51 52320.02
149398.07 52126.69
149623.94 52014.52
149816.52 51853.69
149913.33 51805.61
150072.11 51563.76
150134.85 51418.51
150180.57 51224.64
150259.83 51095.63
150435.38 50886.19
150321.29 50869.5
150191.18 50868.9
150077.35 50868.37
149865.17 50818.88
149571.94 50785.18
149279.47 50800
149133.63 50831.67
149005.07 50928.11
148829.25 51121.38
148831.56 51266.94
148786.62 51509.32
148756.15 51638.56
148807.75 51816.69
148826.84 51994.68
148877.93 52140.46
149046.45 52513.21
    Pen (1,2,0)
    Brush (2,16777215,16777215)
    Center 149595.77 51649.2

As you can see, this is totally different from the "normal" GIS 
approach, where graphical appearance of a geographical item depends on 
its data.
This mapinfo way is absolutely horrible, it regularly leads to some 
catastrophes... especially in the geological world... ;)

> (the is no style information contained in any of the shapefile files), QGIS can't interpret it. Depending on the Mapinfo file format, you could propably write a converter to QGIS style files.
>   
For this, you need to read the graphical attributes from the .mif file 
(not the original .tab, .dat, .id, .ind), and put the graphical 
attributes as "normal" attributes in the .mid file. And then only, do a 
style.

A faster approach would be to first use mapinfo. Some extensions (like 
discover) allow to do "select by graphical appearance" or something 
similar (if I remember well: I have no more mapinfo around 
(fortunately!)), and then you can, in the mapbasic window (which should 
always be opened somewhere), type:
    UPDATE selection SET geol_unit = "Burdigalian limestone"

You change the graphical selection using the same extension, you now 
pick up the green hashed polygons for instance, and then type:
    UPDATE selection SET geol_unit = "Birimian B1 greywacke"

And so on.

This way, you inform your attributes table.

Parenthesis: (
This is something very neat and efficient in mapinfo (yes, it has some 
qualities!): this little mapbasic window allows you to run plenty of 
commands (sql or map making or graph plotting or... ), and the 
"selection" always corresponds to whatever data is actually selected.
Repeating mapbasic instructions while playing with the selection is 
extremely efficient.

Idea: why not try to implement this kind of approach in qgis?
)

Once you're done, you can open your file again in qgis (or any other 
"normal" GIS package) and do a "thematic analysis" (in mapinfo terms) on 
your attributes. And you pick up the right colors, patterns, etc. for 
each formation.

Hope it helps...

A+
Pierre

-- 
____________________________________________________________________________
Pierre Chevalier Géologue EI
    Mesté Duran
    32100 Condom
  Tél+fax  :    09 75 27 45 62
                05 62 28 06 83
		06 37 80 33 64
  Émail  :   pierrechevaliergeolCHEZfree.fr
  icq#   :   10432285
  skype  :   pierre.chevalier1967
  http://pierremariechevalier.free.fr/pierre_chevalier_geologue
____________________________________________________________________________




More information about the Qgis-user mailing list