Spatial

Cells in grid crossed by a line ( PHP )

此生再无相见时 提交于 2019-12-13 04:32:14
问题 I have a mesh of cells in memory. I know the width and height of the cells, X0,Y0, X1,Y1, X2,Y2. Given a line connecting (X1,Y1) to (X2,Y2) I would like a way to determine the cells crossed by this line. I have hashed the cells that should get sellected in my drawing. I would like an idea on how to solve this and i will build the implementation in PHP. 来源: https://stackoverflow.com/questions/30707433/cells-in-grid-crossed-by-a-line-php

poly2nb function takes too much time to be computed

半腔热情 提交于 2019-12-13 03:14:18
问题 I have a data frame that have information about crimes (variable x), and latitude and longitude of where that crime happened. I have a shape file with the districts from são paulo city. That is df: latitude longitude n_homdol 1 -23.6 -46.6 1 2 -23.6 -46.6 1 3 -23.6 -46.6 1 4 -23.6 -46.6 1 5 -23.6 -46.6 1 6 -23.6 -46.6 1 And a shape file for the districts of são paulo,sp.dist.sf : geometry NOME_DIST 1 POLYGON ((352436.9 7394174,... JOSE BONIFACIO 2 POLYGON ((320696.6 7383620,... JD SAO LUIS 3

Converting geometry(spatial) to longitude and latitude

丶灬走出姿态 提交于 2019-12-13 02:58:22
问题 I've uploaded .SHP files to my table in sql and I got geometry column with data. I can see points on "Spatial results" tab in sql server and that's all fine. When I run this line in sql server SELECT [geom].STAsText() FROM myTable I get these kind of results POINT (444386.4927124856 5073381.9183241855) So is there any way to convert this to regular latitude and longitude. 来源: https://stackoverflow.com/questions/22611331/converting-geometryspatial-to-longitude-and-latitude

How to compute greatest distance between polygon centroid and edge

邮差的信 提交于 2019-12-13 02:57:40
问题 I have a SpatialPolygons(DataFrame) object, e.g. SpP library(sp) Sr1 = Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2))) Sr2 = Polygon(cbind(c(5,4,2,5),c(2,3,2,2))) Sr3 = Polygon(cbind(c(4,4,5,10,4),c(5,3,2,5,5))) Sr4 = Polygon(cbind(c(5,6,6,5,5),c(4,4,3,3,4)), hole = TRUE) Srs1 = Polygons(list(Sr1), "s1") Srs2 = Polygons(list(Sr2), "s2") Srs3 = Polygons(list(Sr3, Sr4), "s3/4") SpP = SpatialPolygons(list(Srs1,Srs2,Srs3), 1:3) I would like to, for each polygon, calculate the greatest distance between

Problem with Oracle (Spatial Geometry) query

被刻印的时光 ゝ 提交于 2019-12-13 02:43:20
问题 I'm trying to form a query that returns a list of entities within a given rectangle, using SDO_WITHIN_DISTANCE. The query I've made seems like it should work, but Oracle is giving me some strange errors. Here's the query: SELECT * FROM TBLENTITYLOCATION TL INNER JOIN TBLENTITY TE ON TE.ENTITYID=TL.ENTITYID WHERE SDO_WITHIN_DISTANCE (TL.GEOLOCATION , SDO_GEOMETRY (2003 , NULL , NULL , SDO_ELEM_INFO_ARRAY(1, 1003, 3) , SDO_ORDINATE_ARRAY(41, -73, 36, -82) ), 'DISTANCE=10 UNIT=M' ) = 'TRUE' AND

Can STWithin or STContains be used to update columns based on point within polygon relationship?

ぐ巨炮叔叔 提交于 2019-12-12 21:29:43
问题 Given the following tables: CREATE TABLE #USGS_24K_TOPOMAP_BOUNDARIES( [OBJECTID] [int] NOT NULL, [AREA] [numeric](38, 8) NULL, [PERIMETER] [numeric](38, 8) NULL, [QD24K_GRSM] [numeric](38, 8) NULL, [QD24K_GR_1] [numeric](38, 8) NULL, [QUADID] [numeric](38, 8) NULL, [CENTLAT] [numeric](38, 8) NULL, [CENTLONG] [numeric](38, 8) NULL, [NAME] [nvarchar](35) NULL, [STATE] [nvarchar](2) NULL, [LATLONG] [nvarchar](9) NULL, [OHIO_INDEX] [nvarchar](8) NULL, [GRID60] [nvarchar](5) NULL, [Reviewed] [int

Spatial Index not being used

微笑、不失礼 提交于 2019-12-12 18:08:37
问题 I have a spatial index on GEO_LOCATION column, but when I do EXPLAIN it doesn't show that the index is being used. Can anyone tell why? EXPLAIN SELECT AsText(GEO_LOCATION) FROM PERSON WHERE ST_Distance(POINT(-94.0724223,38.0234332), GEO_LOCATION) <= 10 id: 1 select type: SIMPLE table: PERSON type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 612602 Extra: Using where This is my environment: Server type: MariaDB Server version: 10.1.8-MariaDB - mariadb.org binary

Extract number of raster cells included in a SpatialPolygons

最后都变了- 提交于 2019-12-12 16:51:23
问题 I would like to create a function to count the number of raster cells within the polygons of a SpatialPolygonsDataframe object and adding the value as a new column without using a loop. I cannot find how to do it... Here is my code: library(sp) library(raster) # Create a SpatialPolygonsDataframe and a raster objets to overlay # Polygons p1 <- rbind(c(-180,-20), c(-140,55), c(-50, 0), c(-140,-60), c(-180,-20)) p2 <- rbind(c(-10,0), c(140,60), c(160,0), c(140,-55), c(-10,0)) p3 <- rbind(c(-125

How to use the same color scale for points in different maps in R?

自作多情 提交于 2019-12-12 14:34:18
问题 I have an object of the class SpatialPointsDataFrame which looks like: coordinates div score 1 (-86.2905, 32.7131) 1 0.73 2 (-113.17, 34.4462) 2 3.00 3 (-112.769, 35.1567) 4 0.94 4 (-113.193, 33.9167) 5 4.09 5 (-113.265, 34.407) 1 1.50 6 (-113.585, 34.8241) 2 5.98 7 (-113.793, 34.7597) 3 2.55 8 (-113.651, 35.1733) 2 3.21 9 (-113.675, 35.3431) 4 2.83 10 (-113.09, 34.4036) 5 6.07 11 (-114.172, 34.6878) 1 4.56 12 (-120.153, 37.3049) 3 7.00 and what I want is to produce one map for each "div"

3d spatial objects in sql server

烈酒焚心 提交于 2019-12-12 13:07:59
问题 Is there any way I can define a 3D solid within SQL Server using the spatial data type? If so, can I see an example of how this would be done? say, just a 1x1x1 simple cube? Would I have to define 6 polygons (1 for each face of the cube) and use those together somehow? Everything I have read online tends to show examples purely with 2D shapes. I do know the Point type can handle X,Y,Z (and M) - So spatial 3D is possible, but I am finding it hard to get good examples. Especially of polygons /