geo

Geo distance calculation using SparkR

北城余情 提交于 2020-01-23 04:08:38
问题 I have a Spark dataframe in R as follows head(df) Lat1 Lng1 Lat2 Lng2 23.123 24.234 25.345 26.456 ... ... ... ... The DataFrame contains two points Latitude and Longitude I would like to calculate the Geo distance between the nodes in each row and add it to a new column. In R I am using distCosine function from geosphere library. df$dist = distCosine(cbind(df$lng1,df$lat1),cbind(df$lng2,df$lat2)) I am wondering how I should calculate it in SparkR. SparkR produces the following error, Error in

Pandas: fastest way to resolve IP to country

南笙酒味 提交于 2020-01-22 08:05:58
问题 I have a function find_country_from_connection_ip which takes an ip, and after some processing returns a country. Like below: def find_country_from_connection_ip(ip): # Do some processing return county I am using the function inside apply method. like below: df['Country'] = df.apply(lambda x: find_country_from_ip(x['IP']), axis=1) As it is pretty straightforward, what I want is to evaluate a new column from an existing column in the DataFrame which has >400000 rows. It runs, but terribly slow

Pandas: fastest way to resolve IP to country

淺唱寂寞╮ 提交于 2020-01-22 08:04:49
问题 I have a function find_country_from_connection_ip which takes an ip, and after some processing returns a country. Like below: def find_country_from_connection_ip(ip): # Do some processing return county I am using the function inside apply method. like below: df['Country'] = df.apply(lambda x: find_country_from_ip(x['IP']), axis=1) As it is pretty straightforward, what I want is to evaluate a new column from an existing column in the DataFrame which has >400000 rows. It runs, but terribly slow

How to get list of countries IP Address ranges from WHOIS server?

社会主义新天地 提交于 2020-01-15 02:39:10
问题 I want to get all countries ip addresses range from IANA's whois server, Not from maxmind or ip2location site. IANA is authentic site hence I would like to get all ipaddress ranges for countries from that site. Is it possible to query the WHOIS server such a way?? 回答1: Its not possible to directly get the ip addresses allotted to any country like that. IP numbers are allocated to regional internet registries. There are 5 of them , ARIN , APNIC , AFRINIC , LACNIC , RIPE And again , these RIR

What is the proper way to use D3's projection.stream()?

岁酱吖の 提交于 2020-01-13 07:32:48
问题 So I'm experimenting a bit with D3's geo stream API , and things feel a bit hazy. I've been reading through the documentation here: https://github.com/mbostock/d3/wiki/Geo-Streams One point of confusion I have is the proper implementation of stream transforms. Let's say I create one: //a stream transform that applies a simple translate [20,5]: var transform = d3.geo.transform({ point:function(){this.stream.point(x+20,y+5)} }) Per the documentation, this.stream references the "wrapped stream."

Store GeoJSON polygons in MongoDB

两盒软妹~` 提交于 2020-01-12 03:33:10
问题 I have the following problem with MongoDB. I got some geo data from my home country and i have to store them into mongodb to set up a simple Web Feature Service. This service will mostly do bounding box queries using the $within operator. The data is in GeoJSON format. Therefore i imported at first the Villages and Cities which are represented as points ( [1,2] ) in this format. No problem. Next step rivers and streets which are LineStrings and according to GeoJSON represented this way [[1,2]

Store GeoJSON polygons in MongoDB

一曲冷凌霜 提交于 2020-01-12 03:32:09
问题 I have the following problem with MongoDB. I got some geo data from my home country and i have to store them into mongodb to set up a simple Web Feature Service. This service will mostly do bounding box queries using the $within operator. The data is in GeoJSON format. Therefore i imported at first the Villages and Cities which are represented as points ( [1,2] ) in this format. No problem. Next step rivers and streets which are LineStrings and according to GeoJSON represented this way [[1,2]

Oracle spatial search within distance

你。 提交于 2020-01-11 20:26:26
问题 I have the following table Cities: ID(int),City(char),latitude(float),longitude(float). Now based on a user`s longitude(ex:44.8) and latitude(ex:46.3) I want to search for all the cities near him within 100 miles/KM. I have found some examples but don`t know how to adapt them to my case select * from GEO.Cities a where SDO_WITHIN_DISTANCE([I don`t know], MDSYS.SDO_GEOMETRY(2001, 8307, MDSYS.SDO_POINT_TYPE(44.8,46.3, NULL) ,NULL, NULL), 'distance = 1000') = 'TRUE'; Any help would be

Pyecharts绘制全球流向图

你。 提交于 2020-01-07 19:08:23
安装 pip(3) install pyecharts 此文版本为v1.6 此文版本为v1.6 此文版本为v1.6 效果图 使用Pycharts绘制一个如上图类似的全球流向图。 pyecharts里的地理图标总共有三种— Geo:地理坐标系,Map:地图,Bmap:百度地图。 Map地图可以绘制全球地图,但不能绘制带有流向的效果图,所以此处需要使用Geo地理坐标系图。 Geo图的类型有scatter(散点图),effectScatter(涟漪散点图),heatmap(热力图),lines(流向图)。 散点图不用说,就是正常的散点图。涟漪散点图类似带有波纹的散点图,像水的涟漪效果一样。 效果如下: 热力图也不用说,就是正常的热力图效果。 我们需要绘制的是流向图。 # 导入Geo包,注意1.x版本的导入跟0.x版本的导入差别 from pyecharts.charts import Geo # 导入配置项 from pyecharts import options as opts # ChartType:图标类型,SymbolType:标记点类型 from pyecharts .globals import ChartType, SymbolType geo = Geo() # 地图类型,世界地图可换为world geo.add_schema(maptype="china") #

将带文字标注的CAD图发布到GeoServer

让人想犯罪 __ 提交于 2020-01-07 17:44:39
所需工具 ArcGis;PostgreSQL数据库;uDig; 一、将CAD图转为shp文件 打开ArcGis的ArcMap 将文字标注保存至shp文件 在 转换工具->转出至地理数据库->CAD至地理数据库 选择CAD图,其余设置默认,点击确定 在ArcToolbox的数据管理工具->要素 中选择 要素转点 选择Annotation,点击确定 转换成功后默认显示该图层 在图层右键->属性,打开标注,勾选 标注此图层中的要素,并在下方选择标注字段,图层即可显示标注 之后在图层上右键->数据->导出数据,选择以Shapefile保存。 将其余文件导出为shp 在其他图层上右键->数据->导出数据,选择以Shapefile保存。 二、将shp文件导入到postgreSQL 由于GeoServer对shp文件中文支持不高,容易出现乱码,所以我选择以数据库发布。 Shapfile到SQL语句:   shp2pgsql 路径/shp数据文件名 新建的数据表名 > 路径/SQL文件名.sql Shapfile直接入库:   shp2pgsql -c 路径/shp数据文件名 新建的数据表名 数据库名|psql -d 数据库名 举例说明:   如将一Shapfile文件“c:/road.shp”导入到数据表“road”中,数据库为“sjzmap”。   1、运行“命令提示符”。   2