geography

Calculate distance between 2 lon lats but avoid going through a coastline in R

≡放荡痞女 提交于 2019-12-02 01:57:42
I am trying to calculate the closest distance between locations in the ocean and points on land but not going through a coastline. Ultimately, I want to create a distance to land-features map. This map was created using rdist.earth and is a straight line distance. Therefore it is not always correct because it not taking into account the curvatures of the coastline. c<-matrix(coast_lonlat[,1], 332, 316, byrow=T) image(1:316, 1:332, t(c)) min_dist2_feature<-NULL for(q in 1:nrow(coast_lonlat)){ diff_lonlat <- rdist.earth(matrix(coast_lonlat[q,2:3],1,2),as.matrix(feature[,1:2]), miles = F) min

Selecting geographical points within area

半腔热情 提交于 2019-12-02 01:23:23
I have a SQL Server 2008 table with a column of the geography datatype. The value is a point (latitude and longitude). How do I query the table to return all rows where the location is within a 10 kilometer radius of a given coordinate? You probably want the STDistance method: http://msdn.microsoft.com/en-us/library/bb933952.aspx Or the STWithin method: http://msdn.microsoft.com/en-us/library/bb933991.aspx This query eventually solved my problem: DECLARE @geoMyPoint geography SET @geoMyPoint = geography::STGeomFromText('POINT(56.5667 9.0333)', 4326); SELECT vchZipCode, nvcCity, vchLat, vchLong

Geography column returned in stored procedure not shown in Entity Framework auto generated complex type

牧云@^-^@ 提交于 2019-12-02 00:21:49
问题 I'm using Entity Framework 6 with .Net 4.5. I have a stored procedure that select and returns data. One of the return columns is a geography type. In Visual Studio 2013, I right click the .edmx file, click "Update Model From Database...". This action gets my stored procedure and creates a complex type of storeprocedurename_Result. All the columns are represented in the complex type objects except the geography type. I don't want to manually modify the complex type. I want to get it

In R how to convert Longitude and Latitude to a format that can be used in ggplot2 or ggmap [closed]

白昼怎懂夜的黑 提交于 2019-12-01 06:12:15
I got a raw Longitude/Latitude data whose format cannot be processed by R map. So I wonder if there are some R functions or algorithms to help me to convert those raw data into a readable format. (Maybe UTM) Here is the raw data I had: Latitude: "32-14-23 N" "31-04-27 N" "33-45-28 N" Longitude: "121-22-38 W" "119-30-05 W" "122-47-52 W" I wish to convert the format as(the sample below is mock data): Longitude: -2.748 Latitude: 53.39 Looks like you have data in degree / minute / second format and you want it in decimal format. You can use the char2dms function in the sp package to go from

In R how to convert Longitude and Latitude to a format that can be used in ggplot2 or ggmap [closed]

拜拜、爱过 提交于 2019-12-01 05:44:54
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 4 years ago . I got a raw Longitude/Latitude data whose format cannot be processed by R map. So I wonder if there are some R functions or algorithms to help me to convert those raw data into a readable format. (Maybe UTM) Here is the raw data I had: Latitude: "32-14-23 N" "31-04-27 N" "33-45-28 N" Longitude:

Linq & unsupported data types (Geography)

牧云@^-^@ 提交于 2019-12-01 03:10:34
问题 So, Linq does not support the Geography data type, which throws a major spanner in the works in the lovely 'drag table onto the Linq design surface' developemnt model. Is there any way that I can extend Linq to work with the Geography datatype? Or will I need to build a whole new datalayer and set of queries for whenever I need to use Geography columns? I've been stuck on this for a few days and can't work out if it's possible. 回答1: Cast the column to a varbinary(max), which Linq to SQL can

'The specified input does not represent a valid geography instance' exception when using SqlGeographyBuilder

北城以北 提交于 2019-11-30 23:11:11
I've written a small application that reads in from a series of KML files and then converts them into the Microsoft.SqlServer.Types.SqlGeography type using the following code: private SqlGeography CreateGeographyFromKML( string kml, bool debug ) { // use SqlGeographyBuilder to help create the SqlGeography type var geographyBuilder = new SqlGeographyBuilder(); // Get co-ordinates var xml = XDocument.Parse(kml); var df = xml.Root.Name.Namespace; XElement coordinates = xml.Descendants(df + "coordinates").Single(); // set the Spatial Reference Identifiers that will used to create the point

How to calculate distance between multiple points in SQL Server?

早过忘川 提交于 2019-11-30 13:44:52
I have table with data from GPS, e.g.: Latitude , Longitude , Time , UserId How to aggregate total distance in specified time frame summing all distances by all points (ordered by time) and group data by user? Thanks If you are using SQL Server, you might be interested in using the geography data type so you can request the database using the dedicated method and geographical index. The geography data type is available since SQL Server 2008, you can more information right here: http://msdn.microsoft.com/en-us/library/cc280766.aspx Once you've got the data into the geography column, you will be

How can I do efficient range searching + counting with latitude/longitude data?

风流意气都作罢 提交于 2019-11-30 11:09:45
问题 I'm working with a large set of points represented by latitude/longitude pairs (the points are not necessarily unique, there could be several points in the set that are at the same location). The points are stored in a database. What I need to do is figure out a way to efficiently perform a search to get the number of points that lie within a given radius (say, 25 miles) of an arbitrary point. The count does not need to be 100% accurate - more importantly, it just has to be fast, and

Finding a geography point within a range of another - SQL Server

百般思念 提交于 2019-11-30 07:37:29
I have a table in SQL Server that has geography datatype column in it. I want to query this table to find rows that fall near (within a range) of another given geography point. Does anyone have any ideas as to the best way to do this? I have 2 options of where to do this type of query. I can write it on the sql server as a stored proc or I can do it in c# code as I am using the Entity Framework for data access. I would have a query that has a range (eg 100m) and a geography point passed in to it. The pseudo code would be something like this... select rows where rows.geo within range of given