about location problem

711
2
07-25-2012 02:17 AM
lujun
by
New Contributor
i have encountered a problem

java code below
Graphic graphic = new Graphic(mMapView.toMapPoint(new Point(x,y))
      ,new SimpleMarkerSymbol(Color.RED,25,STYLE.CIRCLE));
    mGraphicsLayer.addGraphic(graphic);


in the code, parameter x and y are passed from Server side.I don't know why the graphic could not display on the map view
0 Kudos
2 Replies
deleted-user-ATjHIWsdQYmT
Occasional Contributor III
i have encountered a problem

java code below
Graphic graphic = new Graphic(mMapView.toMapPoint(new Point(x,y))
                        ,new SimpleMarkerSymbol(Color.RED,25,STYLE.CIRCLE));
                mGraphicsLayer.addGraphic(graphic);


in the code, parameter x and y are passed from Server side.I don't know why the graphic could not display on the map view


mMapView.toMapPoint() converts screen coordinates to map coordinates.  I imagine your x/y's are in real-world coords, not in screen coords, correct? 

try removing mMapView.toMapPoint and just using:
Graphic graphic = new Graphic(new Point(x,y)
                        ,new SimpleMarkerSymbol(Color.RED,25,STYLE.CIRCLE));
                mGraphicsLayer.addGraphic(graphic);


Also, make sure your x/y points are in the same coordinate space as your map.
0 Kudos
lujun
by
New Contributor
mMapView.toMapPoint() converts screen coordinates to map coordinates.  I imagine your x/y's are in real-world coords, not in screen coords, correct? 

try removing mMapView.toMapPoint and just using:
Graphic graphic = new Graphic(new Point(x,y)
                        ,new SimpleMarkerSymbol(Color.RED,25,STYLE.CIRCLE));
                mGraphicsLayer.addGraphic(graphic);


Also, make sure your x/y points are in the same coordinate space as your map.


yeah,that's the key ,thanks

i am new ,thanks for figuring the method toMapPoint out
0 Kudos