geospatial

Distance from long lat line segment wrong over long distances [duplicate]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 00:40:42
问题 This question already has answers here : Calculate possible lines from points (2 answers) Closed 5 years ago . I am calculating how far away a point is from a line segment on the earth. My function seemed to work, but as i've increased the distances it's clear it's not working. I presume this is due to the curvature of the earth. In my calculations Rome is shown as 5km from the line: London, UK - 0km Rome, Italy - 5km Cyrene, Libya - 0km But on Google Earth it's actually more like 61km When I

GeoDjango error: 'DatabaseOperations' object has no attribute 'geo_db_type'

僤鯓⒐⒋嵵緔 提交于 2019-12-10 22:07:48
问题 I've been picking apart this problem for about a week. I have looked at all of the other stackoverflow posts and cant figure it out. Anyway, I'm trying to add a geodjango app to my project. This project is still in development, anyway, I have two databases, the default and one labeled locations_db. I want my geodjango functionality in the locations database and all the other stuff in the default database. The locations database is a postGIS database that is working fine and the default is a

Can I store circle and polygon within the same spatially indexed column in postgis?

匆匆过客 提交于 2019-12-10 21:23:43
问题 According to their documentation the spatial objects can be of the following POINT(0 0) LINESTRING(0 0,1 1,1 2) POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1)) MULTIPOINT(0 0,1 2) MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4)) MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1))) GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4)) However , there is no circle type, where I can just store a point and its radius. And have the same feature where I

Add basemap to SpatialPointDataFrames using R

爱⌒轻易说出口 提交于 2019-12-10 21:10:14
问题 I want to add a basemap to my plot, which visualizes three SpatialPointDataFrames. I've already tried the maptools as well as RgoogleMaps package, but both don't work in the way, which I want to. My problem: The SpatialPointDataFrames are not drawn on the GoogleMaps Background map. A minimal example: The city.csv with the following example content: FID,city,POINT_X,POINT_Y 0,New York,-73.996786,40.720813 1,Newark,-74.172237, 40.732196 The R Code: # Load packages library(RgoogleMaps) library

Geo functions from SQL Server 2008 to C# (latitude and longitude points inside or outside polygon/map area)

让人想犯罪 __ 提交于 2019-12-10 21:07:43
问题 In SQL Server 2008 I have: Declare @pointIn geometry Declare @pointOut geometry Declare @polygon geometry SET @polygon = geometry::STGeomFromText('POLYGON((40 -9,40 -6,35 -6,35 -9,40 -9))', 4326) SET @pointIn = geometry::STGeomFromText('POINT (39 -8)', 4326) SET @pointOut = geometry::STGeomFromText('POINT (41 -3)', 4326) select @polygon.STIntersects(@pointIn) select @polygon.STIntersects(@pointOut) And as expected I get results 1 and 0 . Now I am trying to bring the same code to C# using the

Using MySQL 'POINT' and PHP to insert Latitude and Longitude points through a form

拟墨画扇 提交于 2019-12-10 17:52:01
问题 I'm making a web based application that allows users to create routes based on their input. The user adds waypoints to google maps and takes the latitude and longitude points and copies it into a table on the website that then sends the data to a MySQL database using PHP. I'm having trouble with adding the lat and lon points to my MySQL database. I'm using the datatype 'POINT'. However, when I send the point to the database I get the error "Cannot get geometry object from data you send to the

find (near-)minimal covering set of discs on a 2-D plane

人盡茶涼 提交于 2019-12-10 16:59:13
问题 OK, say I've got a bunch of discs sitting on a plane in fixed known locations. Each disc is 1 unit in radius. The plane is fully covered by the set of discs, in fact, it is extensively over-covered by the set of discs, by an order of magnitude or two in some areas. I'd like to find a subset of the discs that still fully cover the plane. Optimal is nice, but not necessary. Here's the before illustration: And here's the after illustration: It seems to me that there's a dual problem having to do

Interpolation of geodata on surface of a sphere

谁说胖子不能爱 提交于 2019-12-10 16:22:05
问题 I have a dataset with lat/lon coordinates and a corresponding 0/1 value for each geolocation (4 to 200+ datapoints). Now, I want to interpolate the voids and add colors to the surface of the globe based on the interpolation results. The main problem I have is to interpolate "around the globe", because currently I do in a plane, which obviously does not work. My data set.seed(41) n <- 5 s <- rbind(data.frame(lon = rnorm(n, 0, 180), lat = rnorm(n, 90, 180), value = 0), data.frame(lon = rnorm(n,

How do I clean up self-intersecting polygons in a spatial database?

≯℡__Kan透↙ 提交于 2019-12-10 15:33:53
问题 I have some spatial data (MapInfo files) that contains self-intersecting polygons. These cause problems in my processing, in particular I can't generate geometric unions in PostGIS. Is there an easy way to resolve the issue? I can deal with multi-polygons if that should be necessary. 回答1: I figured it out myself: an st_buffer(wkb_geometry,0) does the trick, at least on my sample data. 来源: https://stackoverflow.com/questions/4846391/how-do-i-clean-up-self-intersecting-polygons-in-a-spatial

Set the right crs on sf object to plot coordinate points

最后都变了- 提交于 2019-12-10 15:10:06
问题 I'm trying to define the right CRS for my sf object. I want to plot points atop the following layer (country: the Netherlands): Simple feature collection with 380 features and 3 fields geometry type: MULTIPOLYGON dimension: XY bbox: xmin: 13565.4 ymin: 306846.2 xmax: 278026.1 ymax: 619232.6 epsg (SRID): NA proj4string: +proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +no_defs output: This layer has the correct projection