geospatial

What would a minimal example for a choropleth map in Mathematica look like?

混江龙づ霸主 提交于 2019-12-03 03:28:58
What would a minimal example for a choropleth map in Mathematica look like? I can read in a ESRI Shapefile using Import , but do not know how to work with the imported result. Graphics[ { ColorData["ThermometerColors"][ Rescale[CountryData[#, "GDPPerCapita"], {100, 50000}] ] /. HoldPattern[Blend[___]] -> Yellow, CountryData[#, "Polygon"] } & /@ CountryData[] ] And why the replacement? If there are no data of the required type for a given country CountryData returns Missing["NotAvailable"], causing ColorData , and its underlying Blend function not to return a specific RGB value. I replace this

GeoDjango, difference between dwithin and distance_lt?

感情迁移 提交于 2019-12-03 01:49:01
Using geoDjango, what is the difference between myObj.objects.filter(point__dwithin(...etc.)) and myObj.objects.filter(point__distance_lt(...etc.)) ? Are they the same thing, or are they doing subtly different things? Ok, I did some research but I don't know if the results are of any use ;) I looked at the unit tests that they use to test the DB queries but they don't give real hints (to me). I tried to compare the generated SQL: I have already a geo application using a PostgreSQL databse. When I perform this query with __distance_lt : Place.objects.filter(location__distance_lt=(p.location, D

How to make a custom query using django-nonrel and mongodb

五迷三道 提交于 2019-12-03 00:28:44
Is there a recommended way to make a custom query to mongodb using django nonrel? I have an entire site set up and running well, now I am just adding in some geospatial indexing and queries, and wanted to know if for geospatial queries there is already support or if there is a best practice way to do it using a custom made query? I found one answer to this question, let me now if there is a better one. As documented here assign your objects to the MongoDBManager - http://django-mongodb-engine.github.com/mongodb-engine/cool-stuff.html#included-mongodb-batteries from django_mongodb_engine

How to change class from data frame to spatial polygon?

 ̄綄美尐妖づ 提交于 2019-12-02 23:35:30
问题 I have found the same in here How to Convert data frame to spatial coordinates. But in my case, I got very large data. exchange longitude latitude AB 103.3281386 1.594218196 AB 103.3285929 1.593990735 AB 103.3312494 1.591424235 AB 103.3283736 1.594063254 AB 103.3536164 1.622771588 AB 103.3613242 1.627138676 AB 103.3560151 1.619455334 AB 103.3297071 1.593398614 AB 103.3269466 1.596574285 AB 103.3279517 1.593614052 AB 103.3281356 1.593848271 AB 103.3567136 1.620498495 AB 103.3668021 1.63456952

Create & Find GeoLocation in mongoose

旧巷老猫 提交于 2019-12-02 23:28:32
I'm trying to save the longitude/latitude of a location in my user Model and query it with $geoNear . I've looked at almost any page I could find on that topic, but still I'm not sure how to 1) create the model appropriately and how to query it. here's the part of my model: loc: { //type: 'Point', // see 1 //type: String, // see 2 coordinates: [Number], index: '2dsphere' // see 3 }, @1: According the documentation the type must be 'Point' if I want to store a point, but it throws TypeError: Undefined type `Point` at `loc` Did you try nesting Schemas? You can only nest using refs or arrays.

Criteria SpatialRestrictions.IsWithinDistance NHibernate.Spatial

北战南征 提交于 2019-12-02 21:31:53
Has anyone implemented this, or know if it would be difficult to implement this/have any pointers? public static SpatialRelationCriterion IsWithinDistance(string propertyName, object anotherGeometry, double distance) { // TODO: Implement throw new NotImplementedException(); } from NHibernate.Spatial.Criterion.SpatialRestrictions I can use "where NHSP.Distance(PROPERTY, :point)" in hql. But want to combine this query with my existing Criteria query. for the moment I'm creating a rough polygon, and using criteria.Add(SpatialRestrictions.Intersects("PROPERTY", myPolygon)); EDIT Got a prototype

Get Distance in Meters instead of degrees in Spatialite

那年仲夏 提交于 2019-12-02 20:50:17
I have the following query: select distance(GeomFromText('POINT(8 49)',4326),GeomFromText('LINESTRING(8.329969 49.919323,8.330181 49.919468)',4326)) this gives me 0.97 degrees. But I need it in meters and do not know which SRID to transform to. Can somebody give me an example how to get the result in meters for spatialite? The positions are all in Europe. Just multiply the value in degrees by 111195 - this value is (Earth mean radius)*PI/180 - that is 'mean length of one great circle degree in meters on Earth's surface'. The result obtained using this method is within 1% of the geodesic

MongoDB Bound Queries: How do I convert mile to radian?

好久不见. 提交于 2019-12-02 20:44:44
I have a collection of stores with a geospacial index on the location propery. What I am trying to do is given the user's latitude, latitude and a search radius (mi), I want to return the list of stores that are within those parameters. I saw the following example on the MongoDB documentation ( http://www.mongodb.org/display/DOCS/Geospatial+Indexing ), but it looks like the distance is in radians. center = [50, 50] radius = 10 db.places.find({"loc" : {"$within" : {"$center" : [center, radius]}}}) So, what is the formula to convert miles to radians? Solution The awesome people at mongodb-user

ggplot2 fill polygons in shapefile by coords

一曲冷凌霜 提交于 2019-12-02 18:56:25
问题 So i have shapefile (named POWIATY at the bottom of the page). I want to fill the specific polygons by the coords I have. Let's say, I want to fill whole region in: lat:52.599427 lon:20.7572137 I know how to set point coords on the map but how to fill whole polygon in it? 回答1: There are duplicate region names in that shapefile so you'll have to fill by polygon numeric id: library(rgdal) library(rgeos) library(ggplot2) pow <- readOGR("POWIATY.shp", "POWIATY") plot(pow) where <- over

Select all geospatial points inside a bounding box

巧了我就是萌 提交于 2019-12-02 18:33:06
I have a table called 'flags' in a MySQL database with 400,000 rows. This table is made up of geospatial points that represent different positions around the UK. The application I'm creating uses Google Maps. On the map is a button that should toggle the flags visibility on the map. It's my job now to create an API that when passed a bounding box all flags inside the bounding box are returned (so that they can then be displayed on the map). The passed parameters are the North East latitude/longitude and the South West latitude/longitude of the viewport's current position. I now need to perform