I don't know what else you would need to do because this is working for me. I was doing this nested inside a second if block that tests for the presence of a comma in a string entered by a user (lat, long) and the first if is testing for the index of the ",". Map.setExtent(aphicsExtent()) ĮDIT: I took out the second else per your commment. Map.centerAndZoom(graphic.geometry, maxZoom - 1) Add this bit of code after adding your graphic, var mp = webMercatorUtils.webMercatorToGeographic(evt.mapPoint) Try adding this (after my comment line) after you add the graphic to the map.ĮDIT: I do also have this line further up in the script. One other difference is that I'm using a graphics layer ("esri/layers/GraphicsLayer") and adding the graphic to that instead of directly to map.graphics. I'm thinking this may point you in the right direction (instead of maxZoom, you may be able to plug that zoom level 6 in?). Right after I add the graphic, I have this bit of code. I'm not using map.setExtent though (except as a fallback). I just finished doing something very similar so perhaps this will help you. NewExtent.spatialReference = map.spatialReference Var graphic = new esri.Graphic(mp, symbol) Var symbol = new (_CROSS, 30, new (_SOLID, new dojo.Color(), 1), new dojo.Color()) Mp.spatialReference = map.spatialReference When executing this code, it gives me a blank page. Var point=new (x, y, map.spatialReference) I'm trying to insert x, and y coordinates manually through input text, and center the map and zoom it to that point.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |