Embed peta ArcGIS menggunakan ArcGIS javascript API

Embed peta ArcGIS menggunakan ArcGIS javascript AP,

hanya ubah service ArcGIS (dapat diketahui dengan klik URL “http://10.10.10.60:90/ArcGIS/rest/services/”

dan ubah wkid (spatial reference) “wkid”: 4326

ini dia scriptnya :

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″/>
<meta http-equiv=”X-UA-Compatible” content=”IE=7,IE=9″ />
<!–The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices–>
<meta name=”viewport” content=”initial-scale=1, maximum-scale=1,user-scalable=no”/>
<title>Non graphic info window</title>

<link rel=”stylesheet” type=”text/css” href=”http://serverapi.arcgisonline.com/jsapi/arcgis/2.3/js/dojo/dijit/themes/claro/claro.css”>
<script type=”text/javascript” src=”http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.3″></script>
<style type=”text/css”>
/* set title font properties */
.infowindow .window .top .right .user .titlebar .title { font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:14pt; }
/* set content font properties */
.infowindow .window .top .right .user .content { font-style:italic;font-weight:bold; font-size:10pt; }
</style>

<script type=”text/javascript”>
dojo.require(“esri.map”);

var map;
function init() {
var initExtent = new esri.geometry.Extent({“xmin”:106,”ymin”:-1,”xmax”:107,”ymax”:2,”spatialReference”:{“wkid”: 4326}});
map = new esri.Map(“map”,{extent:initExtent});
dojo.connect(map,”onLoad”, function(map) {map.infoWindow.resize(250, 100);} );
map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer(“http://10.10.10.60:90/ArcGIS/rest/services/CIS/MapServer/2″));
dojo.connect(map, “onClick”, addPoint);
}

function addPoint(evt) {
map.infoWindow.setTitle(“Coordinates”);
//Need to convert the coordinates from the map’s spatial reference (web mercator) to geographic to display lat/lon values
var geoPt = esri.geometry.webMercatorToGeographic(evt.mapPoint);
map.infoWindow.setContent(“lat/lon : ” + geoPt.y.toFixed(2) + “, ” + geoPt.x.toFixed(2) +
“<br />screen x/y : ” + evt.screenPoint.x + “, ” + evt.screenPoint.y);
map.infoWindow.show(evt.mapPoint,map.getInfoWindowAnchor(evt.screenPoint));
}

dojo.addOnLoad(init);
</script>
</head>
<body>
<div id=”map” style=”width:1024px; height:512px; border:1px solid #000;”></div>
</body>
</html>

Share on Facebook
This entry was posted in ArcGIS, Web GIS. Bookmark the permalink.

2 Responses to Embed peta ArcGIS menggunakan ArcGIS javascript API

  1. hartono says:

    Nice info
    Kapan ya bisa belajar Script? bisa private kah?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>