Spatial

sql geography to dbgeography?

风流意气都作罢 提交于 2019-11-26 16:11:04
问题 Maybe I'm missing something. I have a sql server column of the "Geography" datatype. I want to use the DbGeography type in my c# code. Any way to cast or convert from sql's geography to dbgeography? 回答1: Sorry for the late response - but saw this whilst searching for something else. Simply do the following: SqlGeography theGeography; int srid = 4326; // or alternative DbGeography newGeography = DbGeography.FromText(theGeography.ToString(), srid); To reverse it: DbGeography theGeography;

SQL Server 2008 Spatial: find a point in polygon

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 15:59:32
问题 I am using SQL Server 2008 spatial data types. I have a table with all States (as polygons) as data type GEOMETRY. Now I want to check if a point's coordinates (latitudes, longitudes) as data type GEOGRAPHY, is inside that State or not. I could not find any example using the new spatial data types. Currently, I have a workaround which was implemented many years ago, but it has some drawbacks. I've both SQL Server 2008 and 2012. If the new version has some enhancements, I can start working in

Crop for SpatialPolygonsDataFrame

不羁岁月 提交于 2019-11-26 13:57:17
问题 I have two SpatialPolygonsDataFrame files: dat1, dat2 extent(dat1) class : Extent xmin : -180 xmax : 180 ymin : -90 ymax : 90 extent(dat2) class : Extent xmin : -120.0014 xmax : -109.9997 ymin : 48.99944 ymax : 60 I want to crop the file dat1 using the extent of dat2. I don't know how to do it. I just handle raster files using "crop" function before. When I use this function for my current data, the following error occurs: > r1 <- crop(BiomassCarbon.shp,alberta.shp) Error in function (classes

Python: find contour lines from matplotlib.pyplot.contour()

放肆的年华 提交于 2019-11-26 12:22:04
问题 This question was migrated from Mathematica Stack Exchange because it can be answered on Stack Overflow. Migrated 6 years ago . I\'m trying to find (but not draw!) contour lines for some data: from pprint import pprint import matplotlib.pyplot z = [[0.350087, 0.0590954, 0.002165], [0.144522, 0.885409, 0.378515], [0.027956, 0.777996, 0.602663], [0.138367, 0.182499, 0.460879], [0.357434, 0.297271, 0.587715]] cn = matplotlib.pyplot.contour(z) I know cn contains the contour lines I want, but I

What&#39;s the best way to store co-ordinates (longitude/latitude, from Google Maps) in SQL Server?

北战南征 提交于 2019-11-26 11:56:27
问题 I\'m designing a table in SQL Server 2008 that will store a list of users and a Google Maps co-ordinate (longitude & latitude). Will I need two fields, or can it be done with 1? What\'s the best (or most common) data-type to use for storing this kind of data? 回答1: Take a look at the new Spatial data-types that were introduced in SQL Server 2008. They are designed for this kind of task and make indexing and querying much easier and more efficient. More information: MS TechNet: SQL Server 2008

Bulk insert with text qualifier in SQL Server

旧巷老猫 提交于 2019-11-26 11:37:19
问题 I am trying to bulk insert few records in a table test from a CSV file , CREATE TABLE Level2_import (wkt varchar(max), area VARCHAR(40), ) BULK INSERT level2_import FROM \'D:\\test.csv\' WITH ( FIRSTROW = 2, FIELDTERMINATOR = \',\', ROWTERMINATOR = \'\\n\' ) The bulk insert code should rid of the first row and insert the data into the table . it gets rid of first row alright but gets confused in the delimiter section . The first column is wkt and the column value is double quoted and has

Different legends and fill colours for facetted ggplot?

一世执手 提交于 2019-11-26 11:23:17
问题 Sorry for not included any example data for my problem. I couldn’t find a way to easily produce an example shape file. Hopefully, experienced users of ggplot can see what I’d like to do from the description below. I’ve got: A data.frame X with information about sample plots ( plotid , var1 , var2 , var3 , var4 , …) A polygon shapefile Y with spatial information for the sample plots Importation of the shapefile Y (with maptools ) and fortify ing as data.frame Z ( ggplot2 ) works fine. melt ing

Check if point is in spatial object which consists of multiple polygons/holes

帅比萌擦擦* 提交于 2019-11-26 07:39:26
问题 I have a SpatialPolygonsDataFrame with 11589 objects of class \"polygons\". 10699 of those objects consists of exactly 1 polygon, however the rest of those objects consists of multiple polygons (2 to 22). If an object of consists of multiple polygons, three scenarios are possible: Sometimes, those additional polygons describe a \"hole\" in the geographic ara describe by the first polygon in the object of class \"polygons\". Sometimes, those additional polygons describe additional geographic

OSM初识(三)OSM Data

女生的网名这么多〃 提交于 2019-11-25 22:43:08
一 导出数据 将XML格式的OSM数据转换成另一种格式。 二 提取数据 剪切你选择区域内的数据,或者提取出特定区域特定的特征 三 数据格式 OSM文件仅属于OSM,不能用别的软件打开。其中后缀为bz2,pdf的文件是为了节省空间压缩过的OSM文件。一个简单的OSM文件如下图所示: shapefiles是一种用来存储矢量地图数据的格式,是由几个不同文件组成的。比如:一个包含建筑物数据的shapefile可能含有下述三个文件: buildings.shp buildings.shx buildings.dbf 一个shapefile文件只能有一种元素(点/线/形状)特征。不像OSM,里面的每一个目标都可以有无数个Tags,但是shapefile文件元素特征的属性必须符合定义的表格结构,如下图所示。OSM数据可以转化成shapefiles。 OSM数据一般存储在PostgreSQL 数据库或者SQLite数据库。 OSM数据一般存储在PostgreSQL 数据库或者SQLite数据库。下载最新版PostgreSQL:http://www.postgresql.org/download/。会安装三部分文件: • PostgreSQL server:核心部分,数据库软件 • pgAdmin4/3:管理数据库的图形界面 • StackBuilder:用来增加另外的应用