如何获取地理服务器中地址输入的经纬度

时间:2015-03-18 06:35:56

标签: geolocation geospatial

我是geoserver的新手,我想在输入某个地址时获得经纬度,但我没有成功。我不知道该怎么做。 我已下载了几个形状文件,并能够将其加载到地理服务器并加载地图。现在我想传递地址并获得lat长 我试过以下,请帮忙:

包地理服务器;

import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; import it.geosolutions.geoserver.rest.GeoServerRESTReader;

import java.io.File;

公共类GeoREST {

public static void main(String[] args) {

    String RESTURL = "http://localhost:8080/geoserver";
    String RESTUSER = "admin";
    String RESTPW = "geoserver";
    try {
         GeoServerRESTReader reader = new
         GeoServerRESTReader(RESTURL,RESTUSER, RESTPW);
        GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(
                RESTURL, RESTUSER, RESTPW);

        boolean created = publisher.createWorkspace("myWorkspace");
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + created);
        File zipFile = new File("D:/IDM-Marvin/Geoserver/nyc_roads.zip");
        boolean published = publisher.publishShp("myWorkspace", "myStore",
                "nyc_roads", zipFile, "EPSG:4326", "default_point");
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" + published);
        System.out.println("::::::::::::Done:::::::::::::::::::::::");


    } catch (Exception e) {
        e.printStackTrace();
    }
}

}

1 个答案:

答案 0 :(得分:0)

它取决于您可以使用的其他工具,它看起来像。基于this question,您似乎需要使用WMS扩展来获取lat-long。希望有所帮助。