Sf st_read postgis

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Sf st_read postgis

Jan Willem van der Lichte

Hi list,

Can someone help me with a basic sf question.

I try to use the sf::st_read function to get some data out of postgis.

I set up a connection (connz) to postgis.
I checked if the connection was working with

dbListTables(connz)

The result was ok, I saw all the tables in the database.

Next I tried to get some data with the st_read() function, from the sf package.

I tried to follow the example in the help.

xx<- st_read(connz, "vakantie", query="SELECT * FROM vakantie LIMIT 3;")

So i replaced the table meuse with vakantie.

When I execute this statement, I get a warning

Warning message: In st_read.DBIObject(...) : Ignoring query argument, only using table.

So what's happening, am I doing something wrong? Which is possible, cause I'm new to R. :-)

Thanks
Jan Willem














Sent with my iPad

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Sf st_read postgis

Michael DELORME
Hi

If you use a query you don't have to set a table name, so

xx <- st_read(connz, query="SELECT * FROM vakantie LIMIT 3;")

should work...


Le 12/06/2018 12:12, Jan Willem van der Lichte a �crit :

> Hi list,
>
> Can someone help me with a basic sf question.
>
> I try to use the sf::st_read function to get some data out of postgis.
>
> I set up a connection (connz) to postgis.
> I checked if the connection was working with
>
> dbListTables(connz)
>
> The result was ok, I saw all the tables in the database.
>
> Next I tried to get some data with the st_read() function, from the sf package.
>
> I tried to follow the example in the help.
>
> xx<- st_read(connz, "vakantie", query="SELECT * FROM vakantie LIMIT 3;")
>
> So i replaced the table meuse with vakantie.
>
> When I execute this statement, I get a warning
>
> Warning message: In st_read.DBIObject(...) : Ignoring query argument, only using table.
>
> So what's happening, am I doing something wrong? Which is possible, cause I'm new to R. :-)
>
> Thanks
> Jan Willem
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Sent with my iPad
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>
--
*Micha�l DELORME*
Administrateur de donn�es, charg� de projet en g�omatique
Service r�gional de l'information statistique, �conomique et territoriale
Direction r�gionale de l'alimentation, de l'agriculture et de la for�t
Auvergne-Rh�ne-Alpes
Site de Lyon
165 rue Garibaldi � BP 3202 � 69401 LYON cedex 03
04 78 63 34 21

Pour �crire au service :
DRAAF Auvergne-Rh�ne-Alpes � SRISET
16B rue Aim� Rudel � BP 45 � 63370 LEMPDES

http://www.draaf.auvergne-rhone-alpes.agriculture.gouv.fr/

        [[alternative HTML version deleted]]


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Sf st_read postgis

Jan Willem van der Lichte
 
Hi, thx for answering.
 
If I follow your suggestion, I get an error. see below.
 
> xx = st_read(connz, query = "SELECT * FROM vakantie LIMIT 3;")
Error in CPL_hex_to_raw(vapply(x, skip0x, USE.NAMES = FALSE, "")) : 
  char2int: false character in hex string
 
Any other ideas?
 
Thanks Jan Willem
 
 
Sent: Tuesday, June 12, 2018 at 2:29 PM
From: "Michael DELORME" <[hidden email]>
To: [hidden email]
Subject: Re: [R-sig-Geo] Sf st_read postgis
Hi

If you use a query you don't have to set a table name, so

xx <- st_read(connz, query="SELECT * FROM vakantie LIMIT 3;")

should work...


Le 12/06/2018 12:12, Jan Willem van der Lichte a �crit :
> Hi list,
>
> Can someone help me with a basic sf question.
>
> I try to use the sf::st_read function to get some data out of postgis.
>
> I set up a connection (connz) to postgis.
> I checked if the connection was working with
>
> dbListTables(connz)
>
> The result was ok, I saw all the tables in the database.
>
> Next I tried to get some data with the st_read() function, from the sf package.
>
> I tried to follow the example in the help.
>
> xx<- st_read(connz, "vakantie", query="SELECT * FROM vakantie LIMIT 3;")
>
> So i replaced the table meuse with vakantie.
>
> When I execute this statement, I get a warning
>
> Warning message: In st_read.DBIObject(...) : Ignoring query argument, only using table.
>
> So what's happening, am I doing something wrong? Which is possible, cause I'm new to R. :-)
>
> Thanks
> Jan Willem
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Sent with my iPad
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>

--
*Micha�l DELORME*
Administrateur de donn�es, charg� de projet en g�omatique
Service r�gional de l'information statistique, �conomique et territoriale
Direction r�gionale de l'alimentation, de l'agriculture et de la for�t
Auvergne-Rh�ne-Alpes
Site de Lyon
165 rue Garibaldi � BP 3202 � 69401 LYON cedex 03
04 78 63 34 21

Pour �crire au service :
DRAAF Auvergne-Rh�ne-Alpes � SRISET
16B rue Aim� Rudel � BP 45 � 63370 LEMPDES

http://www.draaf.auvergne-rhone-alpes.agriculture.gouv.fr/

[[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo