[postgis-users] Why unrecognized field type?

James David Smith james.david.smith at gmail.com
Tue Dec 3 08:50:28 PST 2013


On 3 December 2013 15:55, Lee Hachadoorian <Lee.Hachadoorian+L at gmail.com>wrote:

> On Tue, Dec 3, 2013 at 5:23 AM, James David Smith <
> james.david.smith at gmail.com> wrote:
>
>> Hi all,
>>
>> Apologies for cross-posting this to the RPostrgeSQL and PostGIS mailing
>> lists, but I'm not sure where the problem lies.
>>
>> I am using the RPostgreSQL package of R to connect to my installation of
>> PostgreSQL/PostGIS. I want to retrieve some coordinates from my database
>> and run the below command. Is this just that R doesn't know what to do with
>> Geometry's, or is it something I should be more concerned about? I ask, as
>> I'm having some wider issues with my workflow and this may be related.
>>
>> Thanks
>>
>> James
>>
>> > dbGetQuery(con, "SELECT st_transform(st_setsrid(st_makepoint(soose::numeric, soosn::numeric),27700),4326) FROM stage WHERE ssid = '707187161010202'")
>>
>>
>> st_transform
>> 1 0101000020E6100000F71184EF3961B3BF830420AF33C64940Warning message:In postgresqlExecStatement(conn, statement, ...) :
>>   RS-DBI driver warning: (unrecognized PostgreSQL field type geometry (id:480912) in column 0)
>>
>>
>>
> James,
>
> R knows how to handle geometries using the sp package, but can't read the
> data in using RPostgreSQL. You would need to use readOGR() in the rgdal
> package. But what data do you actually need in R, and what do you intend to
> do with it? If you're not going to be mapping it or doing spatial
> statistics on it, there may be a way to get the data you want using
> RPostgreSQL.
>
> Best,
> --Lee
>

Hi Lee,

Thanks for the reply.  I was really only after the x and y of the geom, so
I'm now using st_x and st_y functions to get that. I've also figured out
what was going on with my wider workflow (a typo!) , so now all is working
fine. It was good to understand how R deals with geom types though for
future reference.

Cheers

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20131203/54567758/attachment.html>


More information about the postgis-users mailing list