转换GeoJson与CRS"名称":" urn:ogc:def:crs:OGC:1.3:CRS84"谷歌地图lat / long

时间:2017-11-24 07:10:30

标签: google-maps geometry kml geojson ogr

目前我正在寻找一种解决方案,将Google地图上的geojson文件转换为正确的lat-long,如下所示:

well.geojson:

{
    "type": "FeatureCollection",
    "crs": {
        "type": "name",
        "properties": {
            "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
        }
    },
    "features": [{
            "type": "Feature",
            "properties": {
                "WDB_ID": 1,
                "SRC_DATA": "RDI DWQI Database",
                "STD_WELL_I": "RDI_DWQI_1",
                "OTH_WELL_I": null,
                "PROVINCE": "Kampong Cham",
                "DISTRICT": "Batheay",
                "COMMUNE": "Batheay",
                "VILLAGE": "Batheay",
                "VILLAGE_ID": 3010102,
                "CONDITION": null,
                "CONT_NAME": null,
                "CONT_PHONE": null,
                "CONT_QUAL": null,
                "CONT_SECT": null,
                "FACILITY": "School",
                "FACILITY_N": "Unknown",
                "OWNER_NAME": null,
                "OWNER_PHON": null,
                "WGS_E": 494022,
                "WGS_N": 1326178,
                "MSL_APPROX": 9,
                "WELL_TYPE": "Drilled Well",
                "DRI_END_DA": "01-Jan-06",
                "DRI_TOT_DE": 36.0,
                "PUMP_INSTA": "Unknown",
                "PUMP_TYPE": null,
                "PUMP_MODEL": null,
                "PUMP_INST_": null,
                "PUMP_DEP_M": null,
                "PUMP_YIEL_": null,
                "PUMP_RIS_M": null,
                "COORD_SRC": "DATABASE",
                "water qual": "RDI DWQI Database",
                "water qu_1": "RDI_DWQI_1",
                "water qu_2": "27-Feb-08",
                "water qu_3": null,
                "water qu_4": null,
                "water qu_5": null,
                "water qu_6": 7.36,
                "water qu_7": null,
                "water qu_8": null,
                "water qu_9": 0.0,
                "water qu10": 355.0,
                "water qu11": 0.015,
                "water qu12": 3.87,
                "water qu13": 0.0,
                "water qu14": 3.23,
                "water qu15": 342.0,
                "water qu16": null,
                "water qu17": null,
                "water qu18": null,
                "water qu19": null,
                "water qu20": 0.85,
                "water qu21": 0.3,
                "water qu22": 0,
                "water qu23": 2020
            },
            "geometry": {
                "type": "Point",
                "coordinates": [494022.0, 1326178.0]
            }
        },
        {
            "type": "Feature",
            "properties": {
                "WDB_ID": 2,
                "SRC_DATA": "RDI DWQI Database",
                "STD_WELL_I": "RDI_DWQI_2",
                "OTH_WELL_I": null,
                "PROVINCE": "Kampong Cham",
                "DISTRICT": "Batheay",
                "COMMUNE": "Batheay",
                "VILLAGE": "Batheay",
                "VILLAGE_ID": 3010102,
                "CONDITION": null,
                "CONT_NAME": null,
                "CONT_PHONE": null,
                "CONT_QUAL": null,
                "CONT_SECT": null,
                "FACILITY": "Unknown",
                "FACILITY_N": "Unknown",
                "OWNER_NAME": null,
                "OWNER_PHON": null,
                "WGS_E": 494090,
                "WGS_N": 1326303,
                "MSL_APPROX": 7,
                "WELL_TYPE": "Drilled Well",
                "DRI_END_DA": "01-Jan-08",
                "DRI_TOT_DE": 5.0,
                "PUMP_INSTA": "Unknown",
                "PUMP_TYPE": null,
                "PUMP_MODEL": null,
                "PUMP_INST_": null,
                "PUMP_DEP_M": null,
                "PUMP_YIEL_": null,
                "PUMP_RIS_M": null,
                "COORD_SRC": "DATABASE",
                "water qual": "RDI DWQI Database",
                "water qu_1": "RDI_DWQI_2",
                "water qu_2": "27-Feb-08",
                "water qu_3": null,
                "water qu_4": null,
                "water qu_5": null,
                "water qu_6": 6.11,
                "water qu_7": null,
                "water qu_8": null,
                "water qu_9": 0.0,
                "water qu10": 240.0,
                "water qu11": 0.075,
                "water qu12": 1.45,
                "water qu13": 0.18,
                "water qu14": 2.77,
                "water qu15": 128.0,
                "water qu16": null,
                "water qu17": null,
                "water qu18": null,
                "water qu19": null,
                "water qu20": 0.4,
                "water qu21": 0.1,
                "water qu22": 160,
                "water qu23": 36000
            },
            "geometry": {
                "type": "Point",
                "coordinates": [494090.0, 1326303.0]
            }
        }
    ]
}

我尝试使用像ogr2ogr和任何其他在线工具的工具。我得到同样的错误:

使用 ogr2ogr

ogr2ogr -f" KML" -overwrite" well.kml" " well2.GeoJSON" -T_SRS EPSG:4326

错误:

错误1:纬度1326178.000000无效。有效范围是[-90,90]。此警告将不再发布     警告1:已修改经度494022.000000以适应范围[-180,180]。此警告将不再发布

1 个答案:

答案 0 :(得分:2)

最后,我找到了解决问题的方法。坐标系变换的方法有很多,取决于不同的坐标系或制图投影。

1-使用https://mygeodata.cloud/cs2cs

此在线工具允许您插入地理坐标值对并将其转换为不同的坐标系或制图投影。您可以将值对插入标记为"输入坐标对"的文本区域。 - 甚至可以通过MS Excell或类似程序使用复制/粘贴。此工具接受各种值对的输入格式 - 只需要一行一对即可。请参阅输入文本区域窗口中的示例。

enter image description here

2-使用cs2cs命令行(注意:我使用的是Ubuntu)

cs2cs在一组输入点上执行源和目标制图坐标系之间的转换。坐标系变换可以包括投影和地理坐标之间的平移以及基准位移的应用。

cs2cs +proj=utm +zone=48 +a=6377276.345 +b=6356075.41314024 +towgs84=198,881,317,0,0,0,0 +units=m +no_defs +to +proj=longlat +datum=WGS84 +no_defs  source.geojson > target.geojson

示例:converting-coordinates-with-cs2cs

3-使用Proj4js

Proj4js是一个JavaScript库,用于将点坐标从一个坐标系转换为另一个坐标系,包括基准转换。最初是PROJ.4和GCTCP C的一个端口,它是MetaCRS项目组的一部分。

var firstProjection = '+proj=utm +zone=48 +datum=WGS84 +units=m +no_defs';
var secondProjection = "+proj=longlat +datum=WGS84 +no_defs";
proj4(firstProjection,secondProjection,[494022.0, 1326178.0]);

结果:

[104.94123506418815, 11.999521158195288]

我希望这可以帮助其他与我一样面临同样问题的人。