[Qgis-user] Qgis, Postgres Data exchange, Graticule

Pierre Chevalier Géologue pierrechevaliergeol at free.fr
Thu Sep 16 11:04:47 PDT 2010


(Marco, please apologise for my double reply: I first did not pay 
attention that the reply-to was not set to the list.
By the way: this is the only mailing-list I know where the reply-to does 
not reply to the list: wouldn'it be better to change this setting? (that 
was for the administrators of the list))

Marco claviota:
> I would like to directly get postgres - data into qgis with a few mouse
> clicks
>
> Having Data in a postgres database like:
> ...
> The workaround I'm using now is to copy paste the data queried by pgadmin into MS-Editor, add a header, save it as a textfile 
> and from qgis using the Delimited Text Plugin !
> This works, but I'd like to get it more easy and maybe in addition to
> connect to a Postgres-view for easy update.
> Using the PostGIS/Postgres connection fails because the data available is not compliant.
>   
It looks like you need to map some point data.

Here is a workaround that I usually use:
if you have your data in a table named, say, oakaydoc, then you can 
create a view which automagically builds the geometry on-the-fly:

CREATE VIEW oakaydoc_points AS SELECT *, GeomFromText('POINT (' || 
longitude || ' ' || latitude || ')',4326) FROM oakaydoc;

4326 is the reference of the Coordinate Reference System. I grabbed it 
from an old script, I think it must be WGS84 lat/lon. You have to 
replace it by your correct CRS.

Once you have done this (and provided your data is sort of correct) (and 
also that postgis is installed and working), you should be able to map 
your data in qgis.



How does it work? If you look at the result of the view (SELECT * FROM 
oakaydoc_points;), you'll see an additional column at the far end, with 
strange-looking contents: these are the "geometries", generated by the 
function GeomFromText(), using the latitude and longitude fields from 
your table.

> By the way, in the Kore version of QGis a graticule tool was available. Is there such a tool for Tethys too? So, how to add a graticule to a
> qgis(Tethys)-map?
>   
I asked the same question, a while ago: in fact, there is an excellent 
graticule tool in the print composer. I always use it: the print 
composer has become really very neat!



> I would be very grateful receiving your helpful suggestions.
>   
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