2013-11-15 38 views
0

我剛創建的圖片符號,但是當我實現pictureMarkerSymbol時,它仍然給我錯誤。我不知道哪裏出了問題,但這是我正在使用的代碼。Arcgis地圖:PictureMarkerSymbol無法顯示標記,並給出錯誤

此線爲紅色 「http://static.arcgis.com/images/Symbols/Basic/RedStickpin.png」); 它說「圍繞着嘗試和捕捉」 儘管我試圖抓住它,它仍然會給我錯誤。 :(

有人知道如何麻煩拍攝這個

預先感謝您

//------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); 

回答

0

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 
} 

這會編譯。

相關問題