Menu
  • HOME
  • TAGS

guide/information on building an offline mapping Android application using nutiteq

android,dictionary,geolocation,geospatial,nutiteq

It depends what data you want to map. Assuming you use latest Nutiteq Maps SDK 3.x: For offline base maps part see Nutiteq developer portal offline packages For offline map overlays there are several options, and you can choose for example between following Data Sources: For custom app logic use...

Check if location is within a certain distance of a set of other locations using R

r,match,geospatial,distance,latitude-longitude

Is it this, want you were looking for? d <- outer(1:nrow(journey), 1:nrow(POI), FUN=function(i, j) earth.dist(journey[i,"lng"], journey[i,"lat"], POI[j,"lng"], POI[j, "lat"])) apply(apply(d, 1, "-", POI$rad) < 0, 2, function(x) POI$station[x]) ...

MemSQL geospatial union of polygons

union,geospatial,memsql

MemSQL 4 includes topological functions (eg, geography_intersects()) that return a boolean, and measurement functions like distance and length. It does not yet have constructor functions like intersection(), which would output a polygon as you describe. It's on the roadmap, though.

Wraping of equispaced point set in a given direction

java,r,algorithm,geospatial,graph-algorithm

I would do it like this: may be some 2d array point grouping to match the grid that should speed up all the following operations. compute average grid sizes (img1 from left) as two vectors create blue points (img2) as: gray_point (+/-) 0.5*blue_vector create red points (img3) as: blue_point (+/-)...

how to get the distance or radian between two point on the earth with lng and lat?

geolocation,geometry,geospatial

https://github.com/mongodb/mongo/blob/master/src/third_party/s2/s2latlng.cc#L37 GetDistance() return a S1Angle, S1Angle::radians() will return the radians. This belong to s2-geometry-library(google code will close,i export it to my github. Java)....

mapping all of Latin America with rworldmap

r,maps,geospatial,spatial

One way is to select out the countries you are interested in, get the bounding box for these using the bbox function, and then use that to specify the xlim and ylim. Continuing from after your code: #select out your countries sPDFmyCountries <- sPDF[sPDF$NAME %in% df$country,] #use the bbox to...

Polygon insertion issue (due to SRID) on Postgres

postgresql,geolocation,geospatial,postgis,sequelize.js

Two things: You can add a geometry column directly in PostGIS 2.0+ just using the ALTER TABLE command. ALTER TABLE foo ADD COLUMN geom Geometry(Polygon,4326) As the error says, the geometry you're creating from JSON lacks the SRID of the column. So you need to ensure it is set. The...

Extract GPS information to “steady” and “Moving”

android,r,gps,geolocation,geospatial

Here is my attempt. As I mentioned in the comments above, you want to define "short movement" and "long movement" by yourself. In R, you can use lag() in the dplyr package and calculate movement, for instance. I may be wrong, but 1 degree is about 111.32 km. So 0.0001...

Sorting users by distance in mysql using st_distance

php,mysql,geolocation,geospatial

Is it possible to do this entirely through SQL using points and the st_distance function, or will I have to make some changes and use the haversine formula instead? As documented under Geometry Class: Geometry is the root class of the hierarchy. It is a noninstantiable class but has...

Calculate a boundary from set of geo locations

php,mongodb,geolocation,geospatial,geo

Found the solution, apparently the best approach is to calculate the border from application end using "convex hull" algorithm and then query.

Combine results from regex to make x,y pairs

python,regex,geospatial

this can be done without re, for example if this is your string: l = "LINESTRING (-1 -2, -2 3.8, -1 5.6, 0 -3, 1.5 3.3, 2 -23, 6 -12)" grab the numbers from between the parenthesis and put them as string pairs into a list, then iterate through them...

Smoothing out ggplot2 map

r,ggplot2,geospatial,interpolation

The CRAN spatial view got me started on "Kriging". The code below takes ~7 minutes to run on my laptop. You could try simpler interpolations (e.g., some sort of spline). You might also remove some of the locations from the high-density regions. You don't need all of those spots to...

SQL-Server 2008 R2 geoSpatial query error for Circular String

sql,sql-server-2008,geospatial,spatial,spatial-query

As far as I can tell from the docs, CircularString was only added for SQL Server 2012. The only other instantiable curve appears to be LineString which, as the name suggests, encodes a sequence of line segments. So your best bet would be approximating the circle as a (possibly regular)...

Clustering latitude longitude points in Python with fixed number of clusters

python,gis,geospatial,latitude-longitude,k-means

Have you tried kmeans? the issue raised in the liked question seems to be with points that are close to 180 degrees. If your points are all close enough together (like in the same city or country for example) then kmeans might work OK for you.

Elasticsearch geospatial search, problems with index setup

elasticsearch,geospatial

There are a couple issues in your code: Issue 1: When you create your document in the second snippet, you're not using the correct mapping type and your body doesn't include the correct field name as declared in your mapping: client.create({ index: 'events', type: 'geo_point', <-------- wrong type body: {...

Difference in $geoWithin and $geoIntersects operators?

mongodb,geospatial,mongo-java

From $geoIntersects: Selects documents whose geospatial data intersects with a specified GeoJSON object; i.e. where the intersection of the data and the specified object is non-empty. This includes cases where the data and the specified object share an edge. From $geoWithin: Selects documents with geospatial data that exists entirely within...

Add MySQL geospatial Point column in Laravel 4 migration

mysql,laravel,laravel-4,geospatial

You should use statement method: DB::statement("ALTER TABLE meetings ADD COLUMN geolocation POINT"); Update About the second question, you can access to database.php file like this: if (Config::get('database')['default'] === 'mysql'){ // mysql }else if (Config::get('database')['default'] === 'pgsql'){ // PostgreSQL } ...

geo-spacial density based clustering [closed]

sql,database,cluster-analysis,geospatial,computational-geometry

You can try a voronoi diagram. A voronoi diagram is the dual of a delaunay triangulation with some useful properties: https://alastaira.wordpress.com/2011/04/25/nearest-neighbours-voronoi-diagrams-and-finding-your-nearest-sql-server-usergroup.

How to check if a polygon contains another polygon in OL3?

algorithm,openlayers,geospatial,openlayers-3

OpenLayers 3 does not include a function to check if a polygon is inside another polygon. But you could use JSTS, the JavaScript port of JTS Topology Suite to do the check: var feature1 = new ol.Feature(new ol.geom.Polygon(...)); var feature2 = new ol.Feature(new ol.geom.Polygon(...)); var format = new ol.format.GeoJSON(); var...

spatial clustering in R (simple example)

r,geospatial,spatial,hierarchical-clustering

What about something like this: lat<-c(1,2,3,10,11,12,20,21,22,23) lon<-c(5,6,7,30,31,32,50,51,52,53) km <- kmeans(cbind(lat, lon), centers = 3) plot(lon, lat, col = km$cluster, pch = 20) ...

Mongoose aggregation with geonear

node.js,mongodb,mongoose,geospatial,aggregation-framework

You can use the aggregation framework for this and there is no real penalty as the operations are essentially the same. But while the mongoose .find() method presently has a problem with the $nearSphere operator which is equivalent, you can always grab the raw node driver connection object and do...

How to convert a dataframe into a gstat object in R? Specifically a gstatVariogram

r,type-conversion,geospatial,gstat,covariogram

After creating raw.vgm, you have to set its class by class(raw.vgm) = c("gstatVariogram", "data.frame") then, fit.variogram also expects that a variogram has an np field, with the number of pairs of points used; I'm setting it to one by raw.vgm$np = rep(1, nrow(raw.vgm)) and finally the default fit.method assumes you...

Implementing Insertion/Deletion/QueryRange in a Region-Quad tree?

javascript,data-structures,geospatial,region,quadtree

If I understand the wikipedia article the region quadtree holds a bitmap with the full region at each level and the point quadtree holds the convex hull with 4 points.

CKAN - Vector Storer Extension error

python,geospatial,ckan

Ok, finally I considered what Denis advice me and I opened an issue to the team of publicamundi. They said me the following: This extension is not meant to be used as a standalone CKAN extension (anymore). Instead, it's integrated as a plugin into ckanext-publicamundi extension (https://github.com/PublicaMundi/ckanext-publicamundi). Actually, the error...

How can ggplot2 keep jittered locations within a map boundary, such as a US state?

r,ggplot2,geospatial,grob

You can make your own jitter function that jitters the data. Then use the function pnt.in.poly from SDMTools to check if the point is inside the polygon. Otherwise you just jitter the original point again. See below for an example: require(SDMTools) bounded_jitter <- function(mapping, data, bounds, width, height, ...){ #...

Mongo $near query takes 6s on 1.2 millions documents

database,mongodb,query-optimization,bigdata,geospatial

"n" : 1568220 in the explain output means that the query returned 1.5 million docs. So that would explain why it took so long. Using a much smaller $maxDistance is probably a better test....

What's the best way to determine if a point is within a certain distance of a GEOJSON polygon?

geometry,gis,geospatial,geojson,turfjs

Yes, you can use buffer in conjunction with inside to find points within 10 miles of something else, eg, expanding on the existing examples, var pt = point(14.616599, -90.548630) var unit = 'miles' var buffered = buffer(pt, 10, unit) var ptTest = point(-1, 52) var bIn = inside (ptIn, buffer)...

Waypoint matching query for MongoDB or Elasticsearch

mongodb,elasticsearch,mongodb-query,geospatial

This did start as a comment but was clearly getting way to long. So it's a long explanation of the limitations and the approach. The bottom line of what you are asking to achieve here is effectively a "union query" which is generally defined as two separate queries where the...

Polygon data not getting inserted in MySQL

mysql,polygon,geospatial,spatial

Seems like a bug with SQLYog GUI. The data is getting inserted into the MYSQL properly but SQLYog does not show the same. Had to manually check from the mysql command prompt. The data was indeed present in the database. If the query fired is incorrect, then SQLyog will show...

MongoDB geospatial search by zip

mongodb,mongoose,geospatial

That is not how a Geo-spatial index works or really how the queries should work either. Consider that when you created the index your statement was likely something like this: db.zipcodes.ensureIndex({ "loc": "2d" }) So you have asked for a 2d index to be created on the "loc" field, which...

R: ggplot2 fill polygons in shapefile by coords

r,ggplot2,geospatial

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(SpatialPoints(cbind(20.7572137, 52.599427)), pow, TRUE) reg <- data.frame(id=rownames(where[[1]])) map <- fortify(pow) gg <- ggplot() gg <- gg + geom_map(map=map, data=map, aes(x=long, y=lat, map_id=id), fill="white",...

Elasticsearch with geo location

mongodb,elasticsearch,geospatial

Here's one example of a geo filter with a match_all query. And here's another example with sorting.

Finding the distance of a coords from the begning of a route in Python

python,geospatial,shapely

Rather than buffering a geometry, which is expensive and imperfect (since buffering requires a number of segments and many other options), just see if the point is within a distance threshold: if route.distance(p) <= r: return route.project(p) Also, you probably realised by now that your distance units are in degrees....

MBRContains distance from location help MySQL

mysql,performance,optimization,geospatial

The purpose of MBRContains() is to exploit a MySQL geospatial index. When you have lat and lng in their own columns, MBRContains() won't help performance at all. But you can do bounding-rectangle calculations directly with your column values. When you do that, you use the BETWEEN operator to find appropriate...

should i create a vertical partition for geospatial data on a large table

sql,indexing,sql-server-2012,geospatial,partitioning

Short answer - yes. After splitting the table in two, one with just the geometry it seems that the geometry queries are overall faster. The performance of the full text queries is about the same. I suspect this is because the new table with only geometry data is much smaller...

Use of Planet.osm with osmDroid for offline maps

android,geolocation,geospatial,openstreetmap,osmdroid

No, not as you would expect it. The Planet contains raw vector data whereas osmdroid needs pre-rendered raster tiles. You would need a renderer on your mobile device but rendering is a very ressource-intensive task and not really suited for mobile devices. Unless you are using pre-processed data (and ideally...

Geohash not generated in Elastic search

elasticsearch,geolocation,geospatial,geohashing

As per the document enabling geohash flag in geo_point indexes the geohash value . There is a difference in what is indexed and what the _source field of the response represents. The _source field in the response is the original raw json document that is passed for indexing to elasticsearch....

Convert coordinate systems using SQLGeometery

sql-server,geospatial,sqlgeometry

Use the GeometryToGeometry function from Pro Spatial, chapter 8. Source code and data tables: http://www.apress.com/9781430234913...

RavenDB - How to can one make a WithinRadiusOf(radius,lat,lng) query where radius is a document property?

ravendb,geospatial,spatial-query

You cannot ask this question as stated. Instead of storing a radius, store a circle shape from the location, then you can call intersect on that.

2dsphere Index on Document with Valid GEOJSON Polygon Fails with Error: Can't extract geo keys from object, malformed geometry?

mongodb,geospatial,geojson

If you visualize the polygon on GeoJsonLint and look on the west side near 50th street, you'll see the polygon's boundary crosses itself. Note that the two points: [ -73.999830926513672, 40.764034571533203 ], [ -74.00409698486328, 40.76323318481445 ] Are causing the polygon to overlap itself and that is not a correctly formed...

TSQL Geography Spatial Data Polygon Lat/Long Search

sql-server-2008-r2,polygon,geospatial,sqlgeography

In short, yes it is possible. I would suggest you start with the following MSDN link and do a little research from there: Working with Spatial Data Specifically, note the following methods available for use in getting your answer: STWithin() STIntersects() Please note that with SQL 2008 R2, you are...

Getting geodjango query to return distance as an attribute?

python,django,geospatial,geodjango

I had the same problem and the reason was that "In order to conduct geographic queries, each geographic model requires a GeoManager model manager." https://docs.djangoproject.com/en/1.8/ref/contrib/gis/model-api/#django.contrib.gis.db.models.GeoManager The solution would be to add objects = models.GeoManager() to your Location model from django.contrib.gis.db import models class Location(models.Model): ... objects = models.GeoManager() ...

Failure when searching for all polygons near a point using mongoose/mongodb

node.js,mongodb,mongoose,geospatial,geojson

The 2dshpere index should be created on the loc property, not the coordinates property. Try changing your index statement to: AreaSchema.index({loc: '2dsphere'}); Also, indexes are created in the background, sometimes taking a while to be generated, depending on the amount of existing data in the collection. Since your insert and...

Find Mongoid geospacial circles that contain a point

mongodb,mongoid,geospatial

Modelling a "circle" is a valid approach by specifying a "centre" and a "radius", but finding things "within the circle" is generally straightforward if not immediately obvious: Service.collection.aggregate([ # Get the distance from the current location { "$geoNear" => { "near" => { "type" => "Point", "coordinates" => [ 1,...

Spring Data- MongoDB geoNear not getting distributed in replicaset

spring,mongodb,geospatial

It turned out that spring-data-mongodb does not pass the read preference specified on mongoTemplate to the underlying com.mongodb.Mongo connection pool - for aggregations. It would pass the read preference for simple find operations. We had to modify our spring configuration - not using spring data's mongo:mongo which did not provide...

Nearest neighbour in SAS

sas,geospatial,spatial

Your best bet is to look into the clustering procedures, as KNN style clustering is pretty close to what you want (and at minimum cluster analysis can get you to a 'set' of neighbors to check). PROC MODECLUS, PROC FASTCLUS, PROC CLUSTER all give you some value here, as does...

Model.solr_search not working for geospatial filter

ruby-on-rails-4,solr,geospatial,sunspot-solr

I am really sorry to open this issue, I am stupid who have created searches_controller_backup.rb which had old code that was not configured with geospatial filter functionality. The problem was everything was working but because rails was loading searches_controller codes from backup file, it was suppose to looks like it...

MongoDB geoNear command result distance in kilometer

mongodb,gps,distance,geospatial,geojson

The distances are being returned in meters. To convert to kilometers, divide by 1000. You can have MongoDB do this using the distanceMultiplier option: db.runCommand({ "geoNear" : "test", "spherical" : true, "distanceMultiplier" : 0.001, "near" : { "type" : "Point" , "coordinates" : [33.2926487, 44.4159651] } }) ...

Interpolate Spatial Data

r,ggplot2,geospatial,interpolate

The problem is that akima::interp does not fill in every entry. So as you look in the only one "corner" of your data, you only see NA's. You need to "scroll down" to see the interpolated values. It only fills in the region where there is data: library(akima) # should...

C# SQL Geometry Error: Invalid operator for data type. Operator equals equal to, type equals geometry

c#,asp.net,sql-server,geospatial

The data type allows for certain operations and is not as standard. the solution I found was: string cmd2 = "SELECT Circle_ID FROM Circle WHERE Center_Point.STEquals(geometry::STGeomFromText('POINT("; cmd2 += center_lat; cmd2 += " "; cmd2 += center_lng; cmd2 += ")',0)) = 1;"; // 1 = TRUE This post helped me out....

How to transfer longlat format DEM data to utm

r,geospatial,rgdal

Use raster::projectRaster() or (not in R) gdalwarp to transform raster.

Get zoom value from google maps encoded string

google-maps,zoom,polygon,geospatial

Process the path returned from google.maps.geometry.encoding.decodePath(googlePolygon) to create a bounds object for it, then use google.maps.Map.fitBounds with that bounds. var polyPath = google.maps.geometry.encoding.decodePath(googlePolygon); var bounds = new google.maps.LatLngBounds(); for (var i=0; i < polyPath.length; i++) { bounds.extend(polyPath[i]); } map.fitBounds(bounds); ...

NodeJS find country by Lat/Lon

javascript,node.js,geolocation,geospatial

Here is a package for that: https://github.com/vkurchatkin/which-country The API is quite simple: var wc = require('which-country'); console.log(wc([-100, 40])); // prints "USA" it uses R-tree under the hood, so it's much faster than linear scan (O(log n), I suppose)....

MySQL Spatial Simplify Geometries

mysql,geospatial

I am afraid there is no simplify function in MySQL spatial. I filed that as a feature request five years ago, and you can see it has received no attention since then. You have a number of options depending on whether you want to do this as a one off,...

PHP Data Type For MySQL POINT Field

php,mysql,geospatial,spatial,sqldatatypes

This should fix your issue: $latlng = 'POINT(' . $json['results'][0]['geometry']['location']['lat']. " " . $json['results'][0]['geometry']['location']['lng']. ')'; and then wrap your :latlon with PointFromText: $sql = 'INSERT INTO Venues (Name, Street, City, State, Zip, Country, TimeZone, LatLon, Phone, Email, Website, Host, Notes) VALUES (:name, :street, :city, :state, :zip, :country, :timezone, PointFromText(:latlon), :phone,...

how to search within a polygon in solr 4.10

solr,geospatial

Your Solr Version must be 4 or higher and you have to import the JTS jar-file. You also have to define a field with a fieldType of "solr.SpatialRecursivePrefixTreeFieldType". Then you can query using a filter query like fq=geo:"Intersects(10.12 50.02)". But please see my previous post or http://wiki.apache.org/solr/SolrAdaptersForLuceneSpatial4 for more detailed...

Using MySQL 'POINT' and PHP to insert Latitude and Longitude points through a form

php,mysql,geospatial

You need something like SET point_LatLon = GeomFromText('POINT(45.1234 123.4567)') in which the parameter you pass to GeomFromText is a character string like POINT(45.1234 123.4567) I have found that this sort of construct works well if I have two numeric parameters, where ? are the placeholders for those lat and lon...

Is it possible to use a document field as radius with distance function in Google search API?

google-app-engine,geospatial,google-search-api

The search API does not support queries on the form fieldname = other_fieldname. Everything on the right side of the relational operator is interpreted as a constant to search for. How big is the maximum possible radius compared to the smallest possible one? If the difference isn't unreasonably big, perhaps...

Project array content with mongodb

arrays,mongodb,mongoose,coordinates,geospatial

You need to do an $unwind operator on the Location array first in your aggregation pipeline, then $group the resulting documents to apply the accumulator expressions $first and $last. Your aggregation pipeline should look like this (untested): db.foo.aggregate([ { "$unwind": "$location" }, { "$group": { "_id": "$_id", "longitude": { "$first":...

How can I plot a georeferenced dataset in R?

r,ggplot2,geospatial,spatial

Your latitude values in this csv are reverted when compared to the dataset you previously had from the previous question you mentioned. All you have to do is to invert the row numbers in this new dataset: Right after your line: all_data = read.table("windspeed.txt",header = TRUE) Invert the row numbers...

How to check if DbGeography objects overlap

sql,polygon,geospatial,spatial

For whoever it may be useful, I have eventually used 'Intersects' method which seems to be working fine

How to compute greatest distance between polygon centroid and edge

r,geospatial,spatial,sp

Here is a simple function I created that for a given polygon calculates the centroid, and the uses basic geometry to find with point is furthest from the centroid, returning its coordinates: library(sp) library(rgeos) library(ggplot2) Sr2 = Polygon(cbind(c(5,4,2,5),c(2,3,2,2))) Srs2=Polygons(list(Sr2), "s2") spPol=SpatialPolygons(list(Srs2)) find_furthest_point=function(polygon){ coords=fortify(polygon)[,c(1:2)] center=as.data.frame(gCentroid(polygon)) longs=coords[,1] lats=coords[,2] dist_fx=function(long, lat, center=center){...

Can I store circle and polygon within the same spatially indexed column in postgis?

geospatial,postgis,postgresql-9.3,spatial-query,spatial-index

There is no Postgis type for representing a circle with 100% accuracy, ie, with a centre point and a radius, as there is with SQL Server's circular arcs. As pointed out in the comments, you can approximate a circle with the 2nd form of ST_Buffer, ie, ST_Buffer(point, distance, num_seg_quarter_circle). As...

how to configure solr4.10 for geo spatial search for polygon

solr,lucene,geospatial

Just place jts-1.13 in solr-4.10.1/example/solr-webapp/webapp/WEB-INF/lib directory, now data will index fine

a failed attempt at placing a dot over an image based on known lat and lng points

javascript,google-maps,geospatial,latitude-longitude

Assuming the area is a parallelogram, you'll need to know 3 of the vertices of the area and the width/height of the area where you want to draw the pin(e.g. the floorplan-image). The following will use the Geo-and LatLon-libraries from http://www.movable-type.co.uk/scripts/latlong.html An image for better understanding: initially calculate some values:...

Error : increasing 'x' and 'y' values expected in persp {fields}

r,plot,order,geospatial

The problem is the argument z and the ordering of both x and y. As shadow mentions in the comments this needs to be a matrix of dim(z) = length(x) x length(y) in this case 100x100. And apparently x and y need to be both ordered at the same time...

Using geospatial commands in rethinkdb with changefeed

geospatial,rethinkdb

You can't use .getIntersecting with .changes, but you can write essentially the same query by adding a filter after .changes that checks if the loc is within the circle. While .changes limits what you can write before the .changes, you write basically any query after the .changes and it will...

geospatial index with another multikey index… Any solutions?

mongodb,indexing,geospatial,mongodb-query,multikey

True, you can only index on a a single array type of field within a single compound index of a collection, but you seem to be talking about "geo-spatial" queries which are something a little different. There is nothing wrong with this at all: db.collection.ensureIndex({ "location": "2d", "product_list": 1 })...

Find a Location withing a stored Circle

mongodb,geolocation,geospatial,mongodb-query,aggregation-framework

You've stored the information exactly how you should, but there is a different approach to getting the results than you think. What you want to use is a $geoNear and specifically the aggregation framework form of that operator. Here's what you do: db.collection.aggregate([ // Match documents "near" the queried point...

MongoDb Polygon Search Query returns no result

java,mongodb,geometry,geospatial,boundbox

Okay, so the Java MongoDB driver query for the points in the polygone for a GeoJson strcuture like this is BasicDBList points = new BasicDBList(); points.add(bbox.getNe()); points.add(bbox.getSe()); points.add(bbox.getSw()); points.add(bbox.getNw()); points.add(bbox.getNe()); BasicDBList parentList = new BasicDBList(); parentList.add(points); Set<Object> data = new CopyOnWriteArraySet<Object>(); DBObject query = new BasicDBObject("geometry", new BasicDBObject("$geoWithin", new BasicDBObject("$geometry",...

Serve clients with geospatial news

mongodb,indexing,geospatial

The index used by MongoDB for geospatial indexing is based on a geohash, which essentially converts a 2 dimensional space into a one-dimensional key, suitable for B-tree indexing. While this is somewhat less efficient than an R-tree index it will be vastly more efficient than your scenario 1. I would...

Updated Spatial data for Germany on county level

r,geospatial,spatial

Are the openstreetmap administrative areas appropriate? http://download.geofabrik.de/europe/germany.html

SqlGeography STIntersect returns always false

c#,sql-server,geospatial

Sql Server geography types uses the left-hand approach. That is as you create polygon, whatever is to the left as you enclose the polygon is the inside of the polygon. You can read more: SqlGeography: Ring Orientation of Polygons...

MySQL geospatial functions to identify whether a rectangle have points in a non uniform four sided polygon and vice versa

mysql,geospatial,spatial

select * from( (SELECT * FROM table WHERE ST_Intersects(geomfromtext( 'POLYGON(( $rectanglePoint1X $rectanglePoint1Y, $rectanglePoint2X $rectanglePoint2Y,$rectanglePoint3X $rectanglePoint3Y,$rectanglePoint4X $rectanglePoint4Y,$rectanglePoint1X $rectanglePoint1Y))') , geomfromtext( 'POLYGON(( $polygonPoint1X $polygonPoint1Y, $polygonPoint2X $polygonPoint2Y,$polygonPoint3X $polygonPoint3Y,$polygonPoint4X $polygonPoint4Y,$polygonPoint1X $polygonPoint1Y))'))) union(SELECT * FROM usgs_data_repo WHERE ST_Contains(geomfromtext(...

T-SQL opposite of UnionAggregate to disaggregate a multipoint table

sql-server,tsql,geometry,geospatial,spatial

I'm assuming that you ultimately just want the list of distinct points. Assuming that you have a numbers table, here's what I'd do: select @g.STPointN(n.n) from dbo.Numbers as n where n.n <= @g.STNumPoints(); Where @g is the result of your UnionAggregate....

Combining a BTREE and Geographical / SPATIAL index to speed up my query?

mysql,performance,indexing,latitude-longitude,geospatial

If all you need is a bounding-rectangle search the spatial index will yield best performance. But that's not what you need. You need, I believe, to search for a certain single value in a type column, and a lat/long bounding box range. It is not possible to create a compound...

SQL Server Spatial Indexes Setup

sql-server,geospatial,spatial-index

You only need one of the indices for the Position field in each table. Having 2 is redundant and will harm performance from the standpoint that any database writes to those fields would have to update both. You do require having the index in both tables, since you are looking...

MySQL geospatial query - return nearest row

mysql,sql,geospatial,database-performance

First, you have a bit of redundancy in your expression for selecting the distance. I believe you can use glength(LineString(coordinates,POINT(663.422238,10.398996))) AS distance rather than what you have. That might help a bit with performance, but it won't help much. The query as constructed performs a full table scan on your...

MongoDB geospatial difference between $near and $within

mongodb,geospatial

The main differences are $near sorts based on distance from a point; $geoWithin tests for containment in a polygon or multipolygon with GeoJSON coordinates, or containment in one of a set of shapes for 2d coordinates $near returns document from nearest to farthest and any other order requires in-memory sorting;...

GDAL show me a possible path error

python,django,postgresql,geospatial,spatial

You must inform the dynamic loader that the new directory with .so libs exists and should be used. add the /path/to/your/libdir/ to one of the textfiles in /etc/ld.so.conf.d/ (the other postgres / postgis libs {postgres,geos,proj4} will probably already be there somewhere) run ldconfig (as root) (probably) restart postgres ...

MongoDB: Using $geoIntersects or $geoWithin with $near in one query

mongodb,geospatial

This requires an aggregate pipeline. As per mogodb doc for $geoNear, You can only use $geoNear as the first stage of a pipeline. The aggregate function has an entry for an additional query which is where the polygon query will be used to narraw down results based on inclusion in...

finding value of a point between measured points on a 2D plane

geometry,gradient,geospatial

This is the same algorithm for interpolating the height of a point from a triangle. In your case you don't have z values for heights, but some other float value for each triangle vertex, but it's the same concept, still 3D points. Where you have 3D triangle points p, q,...

Count number of buffers that touch a (polygon) feature

buffer,polygon,geospatial,spatial,arcgis

If I understand what you want correctly, then creating the union of buffers won't help you - as it leaves you with a single object and you need the count of all buffered objects intersecting against every object in the original table. In SQL I would join the original (all...

Finding nearest grid value in spatial dataframe in R

r,geospatial,raster,gstat

You can turn x and y into SpatialPoints: SpatialPoints(cbind(x,y)) and use the function over: pts <- SpatialPoints(cbind(x, y)) pts.idw <- over(pts, geog2.idw["var1.pred"]) # Writing extracted values on the map: image(geog2.idw, xlim=c(-125, -110), ylim=c(40, 47)) contour(geog2.idw, add=T, lwd=0.5) map("state", lwd=1, add=T) map("county", lty=3, lwd=0.5, add=T) text(pts, round(pts.idw[,"var1.pred"],4), col = "blue") ...

How to add a SpatialPolygons to a bubble plot in R

r,geospatial,sp

A workaround is to use a custom panel function: bubble(pp, "att", panel=function(...) { sp.polygons(SpP, fill="blue") sp:::panel.bubble(...) }) ...

MongoDB - Geospatial intersection of two polygon

mongodb,geospatial,mongodb-query,aggregation-framework

So looking at this with a fresh mind the answer is staring me in the face. The key thing that you have already stated is that you want to find the "intersection" of two queries in a single response. Another way to look at this is you want all of...

Corners from a SQLGeometry

sql-server,geospatial,sqlgeometry

Since you're using an envelope, it will be a box that's aligned to the axes. It looks to me as though it starts enumerating the corners at the SE and goes counter-clockwise. So, we just need to grab the 1st and 3rd points. declare @g geometry = geometry::STGeomFromText('POLYGON ((-179.231086 51.175092,...

Using ensureIndex for locations in publications in Meteor

javascript,mongodb,meteor,geospatial

Try dropping the current index and create the 2dsphere index, specifying the location field as the key not the coordinates array. To first remove the index and keep your data you can connect to the mongo shell by typing the following into your terminal from your app's root directory (while...

Bottom-up parsing for sqlite R*TREE

sqlite,data-structures,geolocation,geospatial,r-tree

SQLite always searches from the top of the tree. This might not hurt because the top-level entries are most likely to be cached. If you really want to do bottom-up parsing, you have to implement it manually. Database files can be opened from any accessible file system. ...

How to search documents with MongoDB geospatial queries within nearest cities in country?

mongodb,geolocation,geospatial

Most of the "heavy lifting" if this is really done by the general geospatial query itself, so long as you are using operations like $near or ideally $nearSphere with a 2dsphere index to allow for the curvature of the earth. Such queries basically find the "nearest" points to the queried...