New answers tagged

1

From the pyproj FAQ page, it recommends using the Transformer class for this type of operation as it handles datum shifts. I would recommend reading http://pyproj4.github.io/pyproj/stable/gotchas.html#proj-not-a-generic-latitude-longitude-to-projection-converter as it will help clarify if you should use the geodetic CRS or EPSG:4326 in your use case. So, ...


1

I had a hard time tracking this down but finally looked in the pyproj tests for CRS. What you need to do is test whether the input CRS is geographic or not. Test is directly from pyproj python script (above link). def test_is_geographic(): assert CRS({"init": "EPSG:4326"}).is_geographic is True assert CRS({"init": "EPSG:3857"}).is_geographic is ...


0

Just a short remark to the extract function from raster package when you work with lat and lon values - use SpatialPoints: x<- 44.8386 y<- 0.5783 value<-extract(raster, SpatialPoints(cbind(x,y))) Without it, you may just receive NA values.


4

Method 1: Add a reprojector before the coordinate extractor to convert the points from the source coordinate system into LL84. The points will then be in latitude/longitude. Note that following the coordinateExtractor the X attribute will hold longitude and the Y attribute will hold latitude. This method assumes the GDB has the current map projection for ...


0

It's possible that some government entity might be hosting your states districts as a web API service already in which case you may find it easier to programmatically identify these values using HTTPS requests since many scripting languages work well as HTTP clients. For example, here as service hosted by the state of Wisconsin that I could use in a Python ...


1

ST_GeomFromText demands the coordinates in the x1 y1,x2 y2, ... ,xn yn format, as said in the comments. Consider using something like this to adjust the format of your coordinates column: select coordinates, replace(replace(replace(coordinates, ' ', ';'), ',', ' '), ';', ',') as adjusted, ST_GeomFromText('LINESTRING('||adjusted||')') as geom from vejnet....


0

I'd usually load my data into an sp object and use rgdal to project: library(sp) library(rgdal) dfr <- read.csv('~/Downloads/NYPD_Complaint_Data_Current__Year_To_Date_.csv') dfr <- with(dfr, dfr[!is.na(X_COORD_CD) & !is.na(Y_COORD_CD), ] xy <- dfr[, c('X_COORD_CD', 'Y_COORD_CD')] prj <- CRS("+proj=lcc +lat_1=40.66666666666666 +lat_2=41....


1

After posting this I realized that it cannot correctly convert the points when I'm not telling it which columns contain the points I need it to convert. Here's a version that seems to work just fine: ####libraries#### library(proj4) library(tidyverse) library(leaflet) ####working directory#### wd <- ("MY WD") setwd(wd) ####file location#### file <...


2

Here is a very short sample of code that shows the proj4 library is functioning and your proj4string is correct: library(proj4) proj4string <- "+proj=lcc +lat_1=40.66666666666666 +lat_2=41.03333333333333 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +datum=NAD83 +units=us-ft +no_defs" # Source data xy <- data.frame(x=1001557, y=217404) # ...


Top 50 recent answers are included