geospatial

Extract in R fails for small polygons and raster

浪子不回头ぞ 提交于 2020-01-05 04:41:07
问题 This example should be reproducible, the first part (with large polygons) works, the second fails: library(raster) USA.altitude <- getData('alt', country='USA') lower48 <- USA.alt[[1]] Srs1 = Polygons(list(Polygon(cbind(c(-96,-95,-95,-96),c(40,40,41,40)))), "s1") Srs2 = Polygons(list(Polygon(cbind(c(-97,-96,-96,-97),c(40,40,41,40)))), "s2") spdf.large <- SpatialPolygonsDataFrame( SpatialPolygons(list(Srs1,Srs2)), data.frame( z=1:2, row.names=c("s1","s2") ) ) plot(spdf.large) usa.average.elev<

Mongodb geolocation boundaries search/query

痴心易碎 提交于 2020-01-04 15:27:29
问题 I have a documents contains list of location "boxes" (square area). Each box is represented by 2 points (bottom-left or south-west, top-right or north-east). Document, for example: { locations: [ [[bottom,left],[top,right]], [[bottom,left],[top,right]], [[bottom,left],[top,right]] ] } I'm using 2d index for those boundaries points. My input is a specific location point [x,y] and I want to fetch all documents that have at list one box that this point is located in it. Is there any geospatial

Mongodb geolocation boundaries search/query

会有一股神秘感。 提交于 2020-01-04 15:27:28
问题 I have a documents contains list of location "boxes" (square area). Each box is represented by 2 points (bottom-left or south-west, top-right or north-east). Document, for example: { locations: [ [[bottom,left],[top,right]], [[bottom,left],[top,right]], [[bottom,left],[top,right]] ] } I'm using 2d index for those boundaries points. My input is a specific location point [x,y] and I want to fetch all documents that have at list one box that this point is located in it. Is there any geospatial

Python QuadTree index returning nodes

不想你离开。 提交于 2020-01-04 15:18:08
问题 I have a bounding box of a city containing points. I would like to divide this bounding box into sub boxes according to the importance of the points. For example, regions with more points should correspond to higher number of sub-boxes. Regions with less points should respond to less boxes with larger width. I understood that a good data structure for that is a quad tree or maybe a KD-Tree. It turns out that most of these libraries just return me the nearest neighbor (This is their main use).

Sorting users by distance in mysql using st_distance

﹥>﹥吖頭↗ 提交于 2020-01-04 10:12:49
问题 I've done a bit of reading on this but there's hardly any information on doing it using points and the st_distance function in mysql. I suppose this makes sense since according to http://bugs.mysql.com/bug.php?id=70494 it wasn't even documented until halfway through last year. Almost every solution I've seen instead uses separate long and lat columns, and then puts them into the haversine formula like this: sorting distance in MySQL PHP This seems like a really messy way of doing it though

Sorting users by distance in mysql using st_distance

一世执手 提交于 2020-01-04 10:11:45
问题 I've done a bit of reading on this but there's hardly any information on doing it using points and the st_distance function in mysql. I suppose this makes sense since according to http://bugs.mysql.com/bug.php?id=70494 it wasn't even documented until halfway through last year. Almost every solution I've seen instead uses separate long and lat columns, and then puts them into the haversine formula like this: sorting distance in MySQL PHP This seems like a really messy way of doing it though

How do I import an openstreetmaps shape file in R and extract lat/long centroids?

不问归期 提交于 2020-01-04 05:39:29
问题 I am trying to import an openstreetmaps shape file in R using the rgdal package. The shape file I downloaded has 5 components in it: places.cpg places.dbf places.prj places.shp places.shx The files can be accessed at the following location: https://drive.google.com/open?id=0B1ITb_7lHh1EUFVfVWc4ekRfSnc I have to do the following: 1) Import the shape file 2) Extract lat/long of the point or centroid of shape in case of polygon 3) Attach the lat/long pair to the dbf file to do some analysis I am

how to access multipolygon coordinates in mysql

。_饼干妹妹 提交于 2020-01-03 21:08:49
问题 Could you please help me to find the right solution how to access to the individual points of multi-polygon object in mysql? Here is the object: "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [-105.00432014465332, 39.74732195489861], [-105.00715255737305, 39.74620006835170], [-105.00921249389647, 39.74468219277038], [-105.01067161560059, 39.74362625960105], [-105.01195907592773, 39.74290029616054], [-105.00989913940431, 39.74078835902781], [-105.00758171081543, 39.74059036160317],

how to access multipolygon coordinates in mysql

淺唱寂寞╮ 提交于 2020-01-03 21:08:31
问题 Could you please help me to find the right solution how to access to the individual points of multi-polygon object in mysql? Here is the object: "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [-105.00432014465332, 39.74732195489861], [-105.00715255737305, 39.74620006835170], [-105.00921249389647, 39.74468219277038], [-105.01067161560059, 39.74362625960105], [-105.01195907592773, 39.74290029616054], [-105.00989913940431, 39.74078835902781], [-105.00758171081543, 39.74059036160317],

Fine-tuning a geospatial index

时间秒杀一切 提交于 2020-01-03 04:25:23
问题 I just converted my SQL Server 2008 database from using a lat/long pair to using the new geography type. I run queries on businesses that are within 30 miles of a geography::Point, using the STDistance function, like so: WHERE this_.GeoLocation.STDistance(geography::Point(42.738963, -84.5522, 4326)) <= 48280.32 Here is the index that I have on the geography column: CREATE SPATIAL INDEX IDX_Business_GeoLocation ON Business (GeoLocation) USING GEOGRAPHY_GRID WITH ( GRIDS = ( LEVEL_1 = LOW,