【问题标题】:Arcgis Map : PictureMarkerSymbol couldnt show marker and gives errorArcgis 地图:PictureMarkerSymbol 无法显示标记并给出错误
【发布时间】:2013-11-29 04:39:00
【问题描述】:

我刚刚创建了图片符号,但是当我实现图片标记符号时,它仍然给我错误。我不知道出了什么问题,但这是我正在使用的代码。

这条线是红色的 "http://static.arcgis.com/images/Symbols/Basic/RedStickpin.png"); 它说“用try and catch包围” 即使我尝试尝试捕获,它仍然给我错误。 :(

有人知道如何解决这个问题吗?

提前谢谢你

//------if latitutde and longitude is not equal / loop 
    if (eve_lat_default !=0 && eve_longi_default !=0) {
graphicsLayer = new GraphicsLayer();

//--point latlong on location   
Point latlong = new Point(eve_longi_default, eve_lat_default);

//--Convert Spatial reference from 4326(WorldMap) to 3414(ONE MAP)
final Point point = (Point) GeometryEngine.project(latlong, SpatialReference.create(4326),      //WORLDMAP 
                                                                                                                            //CONVERT TO
                                                                                    SpatialReference.create(3414));     //ONEMAP



//Picture Symbol (PIN USING JSON URL FROM ESRI Website)
PictureMarkerSymbol pms = new PictureMarkerSymbol(
                                "http://static.arcgis.com/images/Symbols/Basic/RedStickpin.png");
pms.setAngle(0f);
pms.setOffsetX(0f);
pms.setOffsetY(12f);


//add graphic layer
GraphicsLayer graphicsLayer = new GraphicsLayer();


graphicsLayer.addGraphic(new Graphic(new Point(12, 34), pms));

//add symbol to mapview
mMapView.addLayer(graphicsLayer);

mMapView.zoomToResolution(point,0);

【问题讨论】:

    标签: android map arcgis esri


    【解决方案1】:

    The PictureMarkerSymbol constructor 同时抛出 IOExceptionMalformedURLExceptionMalformedURLException 扩展了 IOException,所以捕获 IOException 就足够了:

    try {
        PictureMarkerSymbol pms = new PictureMarkerSymbol(
            "http://static.arcgis.com/images/Symbols/Basic/RedStickpin.png");
        pms.setAngle(0f);
        pms.setOffsetX(0f);
        pms.setOffsetY(12f);
        GraphicsLayer graphicsLayer = new GraphicsLayer();
        mMapView.addLayer(graphicsLayer);
        graphicsLayer.addGraphic(new Graphic(new Point(12, 34), pms));
    } catch (IOException ioe) {
        //The URL was no good; handle the error
    }
    

    这将编译。

    【讨论】:

    • 我只想点击 PictureMarkerSymbol 以便显示地址弹出窗口
    猜你喜欢
    • 2013-11-24
    • 1970-01-01
    • 2017-04-20
    • 2022-01-24
    • 1970-01-01
    • 2018-05-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-08
    相关资源
    最近更新 更多