Giter Site home page Giter Site logo

pgInsert hang with SPDF about rpostgis HOT 12 CLOSED

imprompt avatar imprompt commented on May 18, 2024
pgInsert hang with SPDF

from rpostgis.

Comments (12)

imprompt avatar imprompt commented on May 18, 2024

This works:
test <- data.frame(x=0, y=0, a=1)
pgInsert(conn, name=c("public", "test_table1"), data.obj=test)
pgMakePts(conn, name = c("public", "test_table1"), srid = 4326)

from rpostgis.

dnbucklin avatar dnbucklin commented on May 18, 2024

Hi Malcolm,

I'm not able to replicate the issue. Do you see any messages printed in the R console prior to the hang/crash?

from rpostgis.

imprompt avatar imprompt commented on May 18, 2024

Running using Rscript in a terminal gives the following:

Creating new table...
Using writeWKT from rgeos package...

 *** caught segfault ***
address 0x1, cause 'memory not mapped'

Traceback:
 1: rgeos::writeWKT(data.obj, byid = TRUE)
 2: pgInsertizeGeom(data.obj, geom, create.table, force.match, conn,     new.id, row.names, alter.names, partial.match, df.mode, geog)
 3: doTryCatch(return(expr), name, parentenv, handler)
 4: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 5: tryCatchList(expr, classes, parentenv, handlers)
 6: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call)[1L]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
 7: try(pgi <- pgInsertizeGeom(data.obj, geom, create.table, force.match,     conn, new.id, row.names, alter.names, partial.match, df.mode,     geog))
 8: pgInsert(conn, name = c("public", "test_table2"), data.obj = test)
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault (core dumped)

from rpostgis.

imprompt avatar imprompt commented on May 18, 2024

Same crash when writing spatial polygons when running:

e <- extent(c(0, 100, 0, 100))
e <- as(e, 'SpatialPolygons')
e <- SpatialPolygonsDataFrame(e, data=data.frame(a=1, b=2))
pgInsert(conn, name=c("public", "test_table3"), data.obj=e)

from rpostgis.

imprompt avatar imprompt commented on May 18, 2024

For points I can use the pgMakePts workaround, but for polygons I can't see a way to add a polygons column after writing a non-geometric data frame.

from rpostgis.

dnbucklin avatar dnbucklin commented on May 18, 2024

Could it be an issue with your rgeos package? Try:

library(rgeos)

test <- data.frame(x=0, y=0, a=1)
coordinates(test) <- ~x + y
writeWKT(test)
[1] "POINT (0.0000000000000000 0.0000000000000000)"

If so you may need to check/re-install your system GEOS package.

from rpostgis.

imprompt avatar imprompt commented on May 18, 2024

Thanks. It looks like regos is the problem, but reinstalling did not fix it.
So not a problem with rpostgis.
Thanks for your help.

from rpostgis.

dnbucklin avatar dnbucklin commented on May 18, 2024

If you install the package wkb, that would allow for limited use of pgInsert (e.g. for single-part points and polygons). But for all other geometry types, it needs the rgeos package and you'd still get the error. Good luck!

from rpostgis.

imprompt avatar imprompt commented on May 18, 2024

Working after building the latest system geos from source. Thanks for the package.

from rpostgis.

basille avatar basille commented on May 18, 2024

Good to see that the problem is solved! @imprompt, for the record, could your give your previous and current versions of geos here (I understand the problem was not rgeos but the geos library directly)? Thanks!

from rpostgis.

imprompt avatar imprompt commented on May 18, 2024

yum install geos: installed v3.4.1, which caused problem
installed v3.7.0 from source to fix.

from rpostgis.

basille avatar basille commented on May 18, 2024

Thanks!

from rpostgis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.