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

How to get latitude and longitude on input of address in geoserver

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

包地理服务器;

进口it.geosolutions.geoserver.rest.GeoServerRESTPublisher; 导入 it.geosolutions.geoserver.rest.GeoServerRESTReader;

导入java.io.File;

public class 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();
    }
}

}

这将取决于您可以使用的其他工具,它看起来像。根据 this question 看来您需要使用 WMS 扩展来获取经纬度。希望有所帮助。