[R-sig-Geo] Attempt to set index in SET_STRING_ELT

Roger Bivand Roger@B|v@nd @end|ng |rom nhh@no
Tue Feb 27 10:50:55 CET 2024


Hi,

in osmdata, osm_id is known to overflow integers, and indeed should always be represented as character: https://github.com/ropensci/osmdata/blob/a37c15268f764e57d4e0b77ee6da5fe4bc9ec3dd/R/get-osmdata-df.R#L75. Why character - would arithmetic on osm_id make sense?

With current osmdata 0.2.5, osmdata_sf() seems to return character osm_id at least for points. If this is another column, probably the same argument applies.

Checking the inputs to the failing function may show something, and traceback() after the error should show the name of the R function calling compiled code in stplanr.

Hope this helps,

Roger

--
Roger Bivand
Emeritus Professor
Norwegian School of Economics
Postboks 3490 Ytre Sandviken, 5045 Bergen, Norway
Roger.Bivand using nhh.no

________________________________________
From: R-sig-Geo <r-sig-geo-bounces using r-project.org> on behalf of Josiah Parry <josiah.parry using gmail.com>
Sent: 27 February 2024 02:02
To: jochen.albrecht using gmail.com
Cc: r-sig-geo
Subject: Re: [R-sig-Geo] Attempt to set index in SET_STRING_ELT

[You don't often get email from josiah.parry using gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

It sounds as if you might be using integers to index some vector. Integers
in R are 32 bit which are limited to a maximum value of 214783647 which is
actually reserved for NA values. Anything larger than that will overflow.

On Mon, Feb 26, 2024 at 19:41 Jochen Albrecht <jochen.albrecht using gmail.com>
wrote:

> I am getting the same kind of error working with stplanr (using function
> route_dodgr) as well as osmdata (using function osmdata_sf), which lets me
> assume that the latter is the culprit. The error is "attempt to set index
> 2786142150/2786142150 in SET_STRING_ELT". The index number is a little
> different, although in both instances, we are talking about a value in the
> 2 billion range.
> The error message is not terribly illuminating. Does anyone know what is
> causing it, and even better, how to work around it?
>
> In the case of the osmdata function, I tried to download a road dataset for
> a four-county region in the (SanFran) Bay Area. I have previously
> successfully downloaded the OSM road network for a larger extent of the
> same geography (albeit directly rather than using the osmdata package).
>
> Dr. Jochen Albrecht, GISP (he/him/his)
>
> Professor for Computational and Theoretical Geography
>
> Department of Geography and Environmental Science
> <http://www.geo.hunter.cuny.edu/>
>
> Hunter College CUNY
>
> 695 Park Avenue
>
> New York, NY 10065 Just published: GIS and Housing: Principles and
> Practices
> <https://sites.google.com/rojasap.com/gisandhousing/>
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo using r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list