Skip to content

resolve warning about datum, in logs/console, when web app tries to upload/read some shapefiles #284

@ejanalysis

Description

@ejanalysis

Messages or warnings printed to console also get logged and clutter the log if not useful.

This is OK:
library(EJAM)
shapefile_from_any(testshapes_2)

Launch app like this, for example:

library(EJAM)
ejamapp(shp=testdata("portland_shp.zip",quiet=T), default_testing=T)

or like this:

library(EJAM)
ejamapp(shp= testshapes_2, default_testing=T)

As it starts to read the file or object, it immediately shows this error and warning in rstudio console/logs (not in app UI):

Error in UseMethod("st_geometry") : 
  no applicable method for 'st_geometry' applied to an object of class "c('SpatialPolygonsDataFrame', 'SpatialPolygons', 'Spatial')"

Warning: sf layer has inconsistent datum (+proj=longlat +datum=NAD83 +no_defs).
Need '+proj=longlat +datum=WGS84'

Seems like the error could happen only within server's reactive called orig_leaf_map reactive or within reactive called data_up_shp. BUT, the problem is not obvious in either one. Unclear where it happens.
The error happens when sf::st_geometry() is called, but that function is called indirectly many times through other sf functions, so it is hard to pin down where the problem happens... sf::st_is_empty and sf::st_geometry_type both use st_geometry. The server uses st_geometry_type() directly, and sf::st_geometry() also happens directly -- and indirectly via sf::st_is_empty() -- within shapefix() which is called by shapefile_from_any() which is called by server's reactive called data_up_shp.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Affects Web Apprelevant to users of web app (directly, or indirectly important to the web app)PRIORITY HIGH-ish but not a bugPRIORITY / URGENCY HIGH, BUT...PRIORITY LOWPRIORITY / URGENCY LOWenhancementUseful feature proposed by devs, maintainers, or agency staff. (vs request from general public)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions