geojson

How to format data for MongoEngine PointField

*爱你&永不变心* 提交于 2019-12-07 22:29:45
问题 So I wanted to do some experiments with location data in mongodb, so I wrote some python code to generate some testing data. Unfortunately the documentation at http://docs.mongoengine.org/apireference.html#mongoengine.fields.PointField isn't explicit about how to format the input. class Location(db.Document): coord = db.PointField(required=True) # GeoJSON Trying to store a list containing the lng/lat fails: >>> a = Location(coord=[1,2]) >>> a.save() mongoengine.errors.OperationError: Could

MongoDB: “Malformed geo query” with $geoIntersect on a polygon

天涯浪子 提交于 2019-12-07 20:59:07
问题 I have events in a collection, each containing a desired location, set a GeoJSON Polygon. I also have service providers in another collection, also with a GeoJSON Polygon, indicating the area where they can deliver. For a given service provider, I'm trying to list all the events that are in a compatible area. However, I get this error: Malformed geo query: { $geoIntersects: { $geometry: { type: "Polygon", coordinates: [ [ [ -31.59327575763251, 115.8574693000001 ], [ -31.59676306691357, 115

Reformatting Json to geoJson in PHP (Laravel)

你说的曾经没有我的故事 提交于 2019-12-07 17:16:13
问题 I have laravel outputting the following: [ { "id": 3, "lat": "38.8978378", "lon": "-77.0365123" }, { "id": 4, "lat": "44.8", "lon": "1.7" }, { "id": 22, "lat": "37.59046", "lon": "-122.348994" } ] i would like it to be the geoJson format: { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [lat, lon]}, "properties": { "name": "value" } } ] } I know i need some sort of loop. But i'm not sure how to structure it in PHP. Any guidance

format geojson from postgis

限于喜欢 提交于 2019-12-07 16:38:49
问题 I am trying to build a GeoJSON object from a SQL query to some GIS point data in a postgis postgresql database. A snippet of my node.js app.js is below. As it stands I understand building the type and features, but don't know how to attach a properties array to each GeoJSON record (in the below, it all renders at the end, separate from (not collated with) the features). THE QUESTION: What do I need to do so that the properties attach (collate) for each record in the loop that builds the

Parsing and plotting GeoJSON in Google Maps v2 Android

余生颓废 提交于 2019-12-07 15:55:42
问题 I have a nice big 27 MB geojson file lying on my SD Card. I has got a large number of features, geometry etc. As I was searching the web I didn't find any support for GeoJSON and Shape Files in Google Maps in Android natively. I want to plot all the geometry on the map (we can optimize it later to show some of the geometry) like point, line, polygon etc. Do I need to write a parser on my own or did I fail to find support of geojson in Google Maps API for Android? 回答1: Try using the Google

Leaflet Markercluster - “this._featureGroup.addEventParent is not a function”

旧时模样 提交于 2019-12-07 10:12:59
问题 I am adding Leaflet.markercluster plugin to my existing Leaflet map. I am getting this error: Uncaught TypeError: this._featureGroup.addEventParent is not a function In relation to the line var locations = L.markerClusterGroup(); . I cannot find any information about what this error might mean. I am linking to the Markercluster JS file, and after Leaflet. Not sure why else it would not be able to find a function. 回答1: That is the error you get when you use Leaflet version < 1 (e.g. 0.7.7 )

JupyterLab安装地图插件

旧巷老猫 提交于 2019-12-07 09:23:21
JupyterLab安装地图插件 (本文所述软件还在发展之中,欢迎加入开源项目,提供建议、测试和开发。) 在 Jupyter 中进行数据分析时,往往需要将数据叠加到地图上。简单的地图需求可以利用matplotlib/echarts/bokeh的地图显示功能,更为复杂的可以使用SuperMap/Leaflet/GMaps提供的地图插件,实现交互的地图操作,可以显示和操作大比例尺的专业级地图,甚至调用专业GIS服务进行空间分析,当然这操作起来也会更复杂一些。 上图来自于Kubernetes和JupyterLab支持, https://github.com/openthings/iclient-python 1、iClientPy iClientPy是由超图软件公司(http://www.supermap.com)开发的一个开源项目,可以将SuperMap iServer和Online服务通过python API访问,并支持Jupyter的编程和集成化分析。目前该项目还在开发之中,尚未形成发布版本(预计2018年底发布)。项目地址如下: 文档, http://iclientpy.supermap.io/geticlientpy.html 源码, https://github.com/SuperMap/iclient-python 由于conda安装国内访问较慢,可以加入镜像站

topoJSON on D3: map doesn't show (but it works on www.mapshaper.org)

五迷三道 提交于 2019-12-07 07:50:27
I'm trying to replicate http://bl.ocks.org/mbostock/4060606 using a UK Counties map. I followed the following steps - pretty much what is suggested on http://bost.ocks.org/mike/map : 1) I downloaded the shapefile from Ordnance Survey and extracted some data using qGIS 2) when ready, I translated the shapefile into GeoJSON using ogr2ogr 3) I converted the GeoJSON into topoJSON making sure the IDs were preserved I pretty much copied the original example for the choropleth from mbostock. However, instead of a nice map, I get a... circle. I wonder if I'm doing some errors with the projection? For

Leaflet polygons losing colour when R Shiny app opened in web browser

僤鯓⒐⒋嵵緔 提交于 2019-12-07 05:56:49
问题 I'm building a map using leaflet in R, to be deployed as a Shiny app. The Shiny app is working fine within RStudio, but when I open it in a web browser the polygons lose their colour. Everything else is fine, the base map is there, the polygons are all there, you can hover over the polygons to see information etc. The only change is that the polygons go from being colourful to all greyed out. No warnings or error messages. I'm working on a mac (Sierra) with the newest versions of R (3.3.3)

Cross-table serialization Django REST Framework

丶灬走出姿态 提交于 2019-12-07 00:12:35
I have two models with a many-to-many relationship and I am trying to return some geojson by using the Django REST Framework. The data I am trying to return is th pub_date and coordinates (represented by a PointField in GeoDjango). Everytime I try and return the geojson I get the error Field name 'city' is not valid for model 'Article' . I'm pretty new to django/geodjango and this is the first time I've used the Django REST Framework. I've gone through the docs but can't work out where I'm going wrong (or maybe even where to start). Here my models and serializers. models.py: class Location