Tilestache - PostgreSQL/PostGIS 中存在的坐标与 PostGeoJSON 提供程序返回的坐标不匹配
Tilestache - Mismatch between the coordinates present in the PostgreSQL/PostGIS and those returned by PostGeoJSON provider
这是我的 Tilestache 配置的相关位,
"points-of-interest":
{
"provider":
{
"class": "TileStache.Goodies.Providers.PostGeoJSON.Provider",
"kwargs":
{
"dsn": "dbname=database user=username host=localhost",
"query": "SELECT loc_id AS __id__, loc_name, geo2 AS __geometry__ FROM location",
"id_column": "__id__", "geometry_column": "__geometry__"
}
}
},
当我访问 -
http://127.0.0.1:8080/points-of-interest/0/0/0.json
我收到回复 -
{
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "Point",
"coordinates": [
-0.0008691850758236021,
0.0002956334943026654
]
},
"type": "Feature",
"properties": {
"loc_name": "TI Blvd, TX"
},
"id": 9
}
]}
上面响应中的坐标是-
"coordinates": [-0.0008691850758236021,0.0002956334943026654]
数据库中的实际坐标 table 是 -
database=# SELECT loc_id AS __id__, loc_name, ST_AsText(geo2) AS __geometry__ FROM location;
__id__ | loc_name | __geometry__
--------+-------------+---------------------------
9 | TI Blvd, TX | POINT(-96.75724 32.90977)
我在这里错过了什么?为什么我的 GeoJSON 响应坐标不同?
table描述是
Table "public.location"
Column | Type | Modifiers
----------+------------------------+-----------
loc_id | integer | not null
loc_name | character varying(70) |
geo2 | geometry(Point,900913) |
Indexes:
"location_pkey" PRIMARY KEY, btree (loc_id)
提前感谢大家的帮助。
插入带有 SRID - 4326 的点解决了这个问题。
这是插页 -
INSERT INTO location(loc_id, loc_name, geo2) VALUES (3, 'Manchester, NH', ST_Transform(ST_GeomFromText('POINT(-71.46259 42.99019)',4326), 900913));
这是我的 Tilestache 配置的相关位,
"points-of-interest":
{
"provider":
{
"class": "TileStache.Goodies.Providers.PostGeoJSON.Provider",
"kwargs":
{
"dsn": "dbname=database user=username host=localhost",
"query": "SELECT loc_id AS __id__, loc_name, geo2 AS __geometry__ FROM location",
"id_column": "__id__", "geometry_column": "__geometry__"
}
}
},
当我访问 -
http://127.0.0.1:8080/points-of-interest/0/0/0.json
我收到回复 -
{
"type": "FeatureCollection",
"features": [
{
"geometry": {
"type": "Point",
"coordinates": [
-0.0008691850758236021,
0.0002956334943026654
]
},
"type": "Feature",
"properties": {
"loc_name": "TI Blvd, TX"
},
"id": 9
}
]}
上面响应中的坐标是-
"coordinates": [-0.0008691850758236021,0.0002956334943026654]
数据库中的实际坐标 table 是 -
database=# SELECT loc_id AS __id__, loc_name, ST_AsText(geo2) AS __geometry__ FROM location;
__id__ | loc_name | __geometry__
--------+-------------+---------------------------
9 | TI Blvd, TX | POINT(-96.75724 32.90977)
我在这里错过了什么?为什么我的 GeoJSON 响应坐标不同?
table描述是
Table "public.location"
Column | Type | Modifiers
----------+------------------------+-----------
loc_id | integer | not null
loc_name | character varying(70) |
geo2 | geometry(Point,900913) |
Indexes:
"location_pkey" PRIMARY KEY, btree (loc_id)
提前感谢大家的帮助。
插入带有 SRID - 4326 的点解决了这个问题。
这是插页 -
INSERT INTO location(loc_id, loc_name, geo2) VALUES (3, 'Manchester, NH', ST_Transform(ST_GeomFromText('POINT(-71.46259 42.99019)',4326), 900913));