我过去曾经使用过GeoKit和acts_as_geocodable.我喜欢GeoKit,但它缺少像named_scopes这样的更好的功能.我不是act_as_geocodable的忠实粉丝,因为它将地址数据复制到自己的表中.
最近,这些宝石似乎维护不足.
那里有哪些积极维护的宝石?
我使用可下载的Geonames数据库用于世界上所有国家,州,县和城市,但我想知道是否有街道数据库?
所以你可以选择:国家 - >州/部门/区 - >(县/地区) - >城市 - >街道在你喜欢的任何国家.
因为当我在Google地图中搜索街道时,我可以看到所有上层(国家/地区/城市).你可以为MySQL下载一个数据库吗?
必须有一个数据库,因为总有国家公司提供这种信息.他们从哪里得到的?
试试:http://maps.googleapis.com/maps/api/geocode/json?address =Őrbottyán,Hungary&sensor = true
在iPhone 4和模拟器上,
-(void)requestFailed:(ASIHTTPRequest *)request {
NSLog(@"geocode fail code: %d",[request responseStatusCode]);
NSLog(@"geocoding failed: %@",[request responseString]);
}
2011-06-01 11:36:27.343 app[1174:307] geocode fail code: 0
2011-06-01 11:36:27.345 app[1174:307] geocoding failed: (null)
Run Code Online (Sandbox Code Playgroud)
在浏览器中,我得到:
"results" : [
{
"address_components" : [
{
"long_name" : "?rbottyán",
"short_name" : "?rbottyán",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Pest",
"short_name" : "Pest",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Hungary",
"short_name" : "HU",
"types" : [ …Run Code Online (Sandbox Code Playgroud) 我在php中使用了一个多边形点检查,但是我遇到了重大错误 - 因为在多边形中不存在的点会出现在内部.
我的基本功能在下面输入(在这里找到,从一个类修改为一个简单的函数:http://www.assemblysys.com/dataServices/php_pointinpolygon.php).我唯一能想到的是某种地方的某种舍入错误?
作为一个例子,我试图确定一个点是否在中央公园,一个简单的广场,但我从公园外的点得到肯定.
感谢您的任何见解,
-D
$central_park = array('40.768109,-73.981885', '40.800636,-73.958067', '40.796900,-73.949184', '40.764307,-73.972959');
$test_points = array('40.7546755,-73.9758343', '40.764405,-73.973951', '40.7594219,-73.9733896', '40.768137896318315,-73.9814176061', '40.7982394,-73.9523718', '40.685135,-73.973562', '40.7777062,-73.9632719', '40.764109,-73.975948', '40.758908,-73.9813128', '40.7982782,-73.9525028', '40.7463886,-73.9817654', '40.7514592,-73.9760405', '40.7514592,-73.9760155', '40.7514592,-73.9759905', '40.7995079,-73.955431', '40.7604354,-73.9758778', '40.7642878,-73.9730075', '40.7655335,-73.9800484', '40.7521678,-73.9777978', '40.7521678,-73.9777728')
function pointStringToCoordinates($pointString) {
$coordinates = explode(",", $pointString);
return array("x" => trim($coordinates[0]), "y" => trim($coordinates[1]));
}
function isWithinBoundary($point,$polygon){
$point = pointStringToCoordinates($point);
$vertices = array();
foreach ($polygon as $vertex) {
$vertices[] = pointStringToCoordinates($vertex);
}
// Check if the point is inside the polygon …Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个程序,将纽约市的x / y坐标转换为lat / lng小数点。我是平面/地球贴图的新手。Ive包括了纽约市在其网站上提供的常数。另外,如果有关于如何执行此操作的好文章,我也想学习!下面是我编写的程序,底部带有注释的输出以及理想值。我有点在黑暗中跌跌撞撞。
#!/usr/bin/python
from math import *
"""
Supplied by NYC
Lambert Conformal Conic:
Standard Parallel: 40.666667
Standard Parallel: 41.033333
Longitude of Central Meridian: -74.000000
Latitude of Projection Origin: 40.166667
False Easting: 984250.000000
False Northing: 0.000000
"""
x = 981106 #nyc x coord
y = 195544 #nyc y coord
a = 6378137 #' major radius of ellipsoid, map units (NAD 83)
e = 0.08181922146 #' eccentricity of ellipsoid (NAD 83)
angRad = pi/180 #' number of radians …Run Code Online (Sandbox Code Playgroud) 我一直在使用javascript Google Maps API来构建以下地图:http://springhillfarm.com.au/locations-map/现在我想在用户搜索搜索栏中的位置时列出最近的5个引脚.
尝试进入像"North Epping"这样的郊区,地图将使用以下功能很好地移动:
$("#searchclick").click(function(){
var address = document.getElementById('searchbar').value;
var address = address + " Australia";
var geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var latitude2 = results[0].geometry.location.lat();
var longitude2 = results[0].geometry.location.lng();
var relocate = new google.maps.LatLng(latitude2, longitude2);
map.setCenter(relocate);
map.setZoom(12);
} //when status is OK
}); // geocode
});
Run Code Online (Sandbox Code Playgroud)
但现在我真的希望它返回最近的5个引脚.
怎么可能在javascript中?
我正在为具有PostGIS功能的PostgreSQL数据库编写客户端。该客户端当然通过php进行通信。但是,我正在寻找可用的postGIS功能的适当文档,这些文档可以从我的php文件调用。
如果能得到一个简单的示例说明如何将POSTGIS功能集成到PHP中,我将不胜感激。
干杯:)
我正在使用谷歌地图切换到leaflet.js.我在谷歌地图中做的一件事似乎无法在leaflet.js中找到,它是计算从地图中心(即搜索位置)到地图两侧的半径.您可以放大和缩小人们正在查看的区域可能会发生显着变化.下面的代码显示了我用谷歌地图做的几行.有人能指出我关于leaflet.js的正确方向吗?
// viewport stores the recommended viewport for the returned result.
// (LatLngBounds)
viewportLatLngBounds = zip.get("location").geometry.viewport;
this.map.fitBounds(viewportLatLngBounds);
this.collection.latitude = viewportLatLngBounds.getCenter().lat();
this.collection.longitude = viewportLatLngBounds.getCenter().lng();
// calculate radius
// get distance..
// from (lat of NE corner), (lng of center)
// to (lat of center), (lng of center)
topCenterLatLng = new google.maps.LatLng(viewportLatLngBounds.getNorthEast().lat(), viewportLatLngBounds.getCenter().lng());
metersRadius = google.maps.geometry.spherical.computeDistanceBetween(viewportLatLngBounds.getCenter(), topCenterLatLng);
this.collection.radius = metersRadius / 1000;
this.collection.radiusUnits = "km";
Run Code Online (Sandbox Code Playgroud) 我在Django中使用GeopositionField来存储我的用户的坐标.现在我想找到最接近当前用户的20个用户的列表.我的GeopositionField可以实现该功能吗?我知道GeoDjango可以轻松搜索距离,但由于我使用Heroku和postgresql,我想降低成本并使用postgressql,安装PostGIS似乎是唯一的选择.
有什么建议?
我想使用地理编码获取建筑物的坐标。目前,我使用Android的GeoCoder类从选定的地址获取坐标,但这些坐标与建筑物的边缘不对应。OSM包含每个建筑物的这些信息,但是我不知道如何通过GeoCoder类获取这些信息。是否可以将OSM与Android的geocoder类一起使用以获取此信息?
geocoding ×10
geolocation ×2
google-maps ×2
php ×2
python ×2
android ×1
coordinates ×1
database ×1
django ×1
function ×1
gis ×1
google-api ×1
iphone ×1
java ×1
javascript ×1
leaflet ×1
mysql ×1
postgis ×1
postgresql ×1