geospatial

Conversion of MySQL binary GEOMETRY fields in PHP

末鹿安然 提交于 2019-12-04 14:49:56
I’m working on an application integrating mapquest maps and using the mapquest API. At this moment I want to achieve the following: the registered user has to input latitude and longitude information, and in the database this information has to be stored as geometry type field. Conversely, a user looking at their account should see the latitude and longitude information that was entered. In an earlier simplified codebase I achieved this directly in the MySQL query, by using the MySQL functions AsText and GeomFromText . But now I’m on CodeIgniter and need to do the conversion in PHP Is there

How do I insert a mysql spatial point with a yii model?

点点圈 提交于 2019-12-04 14:38:55
I have a model type that was generated from a mysql table that has address data and also a spatial POINT field named "coordinates". When a model is created or updated I want to geocode the address and store the latitude and longitude coordinates in the POINT field. My understanding is the way to do this is to geocode the address in the model's beforeSave method. I have done this and have the coordinates in an associative array. Now my question is how can I insert this data into my coordinates field? This is what I'm trying: public function beforeSave() { $singleLineAddress = $this-

Solr Distance Filtering

扶醉桌前 提交于 2019-12-04 14:31:40
问题 I am trying to do distance range search using Solr. I know its very easy to do a search for filtering within the 5km range &q=*:*&fq={!geofilt pt=45.15,-93.85 sfield=store d=5} What I am after is how to do the same thing if I am looking in a range of say 5 to 10 km ?? Thanks 回答1: Here are a couple ways to approach this. So clearly the query goes into a filter query ("fq" param) since the intention is not to modify the score. And lets assume the these parameters are set in the request URL

Fix up shapely polygon object when discontinuous after map projection

一笑奈何 提交于 2019-12-04 14:16:19
This demo program (intended to be run in an IPython notebook; you need matplotlib , mpl_toolkits.basemap , pyproj , and shapely ) is supposed to plot increasingly large circles on the surface of the Earth. It works correctly as long as the circle does not cross over one of the poles. If that happens, the result is complete nonsense when plotted on a map (see below cell 2) If I plot them "in a void" instead of on a map (see below cell 3) the results are correct in the sense that, if you removed the horizontal line going from +180 to -180 longitude, the rest of the curve would indeed delimit the

How to find point related to set of coordinates?

醉酒当歌 提交于 2019-12-04 14:06:54
问题 I have a set of about 5000 geographical (WGS84) coordinates. All of them are inside 40km square. Is there any algorithm / R function to find point, inside square and not in the given set, farthest from any point from set? I mean how to find point in the square where the distance to the nearest point from set is longest ? Now I do it by generating grid of coordinates equally spaced and finding distance from each grid point to the nearest set point. Is there any less numerical / not brute force

Fastest way to determine COUNTRY from millions of GPS coordinates [R]

丶灬走出姿态 提交于 2019-12-04 13:45:50
I have millions of GPS coordinates and want to quickly add a column of the country of the coordinates. My current method works but is extremely slow: library(data.table) #REPRODUCE DATA data <- data.table(latitude=sample(seq(47,52,by=0.001), 1000000, replace = TRUE), longitude=sample(seq(8,23,by=0.001), 1000000, replace = TRUE)) #REQUIRED PACKAGES if (!require("sp")) install.packages("sp") if (!require("rworldmap")) install.packages("rworldmap") if (!require("sf")) install.packages("sf") library(sp) library(rworldmap) library(sf) #CURRENT SLOW FUNCTION coords2country = function(points,latcol

MongoDB geo distance/radius to useful units

旧街凉风 提交于 2019-12-04 13:08:29
问题 I'm using MongoDB geospatial queries -- $near , geoNear , etc. -- and I'd like to know how to turn the dis result of the geoNear command as well as the radius argument for $within queries to/from readable units like miles or kilometers. 回答1: if your data is in geographic coordinates (i.e. 30.47921 N -121.45724 W) then you need to convert your underlying projection with the units you want (choose a projection that preserves distance) or you need to convert the distance in coordinates to

Change Projection in OpenLayers Map

我们两清 提交于 2019-12-04 12:36:09
I want to set "EPSG:4326" as the projection of an OpenLayers map, but when I try it, I always get "EPSG:900913". function init() { var options = { projection: new OpenLayers.Projection("EPSG:4326") // ignored }; map = new OpenLayers.Map('map', options); var layer = new OpenLayers.Layer.OSM.Osmarender("Osmarender"); map.addLayer(layer); ... alert(map.getProjection()); // returns "EPSG:900913" ... } The base map is open street map. How can I set the Projection to EPSG:4326? It is Osmarender that has a hardcoded 900913 projection, nothing to do about that. But have you considered taking things

delphi read xml element

穿精又带淫゛_ 提交于 2019-12-04 12:23:10
I'm new to XML and we need to do GeoCoding with the new Bing Spatial Data API . I've managed to get a result back from them in xml format. How would I read specific elements in the response, ie. the Link, Status and ErrorMessages? <?xml version="1.0" encoding="utf-8"?> <Response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/search/local/ws/rest/v1"> <Copyright>Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used,

Rounding Lat and Long to Show Approximate Location in Google Maps

旧时模样 提交于 2019-12-04 12:18:57
问题 I'm displaying a Google map in my Rails app's view and will be using a marker/overlay. The coordinate data will be coming from a phone (GPS) and stored in my Rails app's db. The problem is, I don't want the precise lat/long visible in the source of my web page ... i.e. I want to mark an approximate location without giving away the true lat/long. How can I round/truncate the lat/long values so they are still accurate (say, within a mile)–but not too accurate? (Example: how would you round 35