It's not that these coordinate aren't 10200. They're just located very close to 0°N, 0°W
By the way, your previous script (received 2 days ago) works, but the 1 you posted today does not. I just wonder why the polyline2 could not be drawn. Thanks.
var testPoint = new Point(201394.01178484457, 173661.08635829584, new SpatialReference({wkid:26973}));
var polylineJson2 = { "paths":[[[201394.01178484457,173661.08635829584],[201392.0117168416,173661.08690949593],[ 201388.01158083565, 173661.08801189612 ],[ 201386.01151283266, 173661.08856309619 ],[ 201384.0114448297, 173661.08911429628 ],[ 201382.0113768267, 173661.08966549637 ],[ 201380.01130882374, 173661.09021669647 ],[ 201378.01124082075, 173661.09076789653 ] ] ],"spatialReference":{"wkid":102100} };
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>Build your first application</title> <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.8/js/esri/css/esri.css"> <style type="text/css"> html, body, #map { padding: 0; margin: 0; height: 100%; } </style> <script src="http://js.arcgis.com/3.8/"></script> <script> var map; require(["esri/map", "dojo/ready", "dojo/on", "esri/geometry/Polyline", "esri/graphic", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleMarkerSymbol", "esri/SpatialReference", "esri/geometry/Point", "dojo/domReady!"], function(Map, ready, on, Polyline, Graphic, SimpleLineSymbol, SimpleMarkerSymbol, SpatialReference, Point) { var map = new Map("map", { center: [-122.58, 45.55], //longitude, latitude zoom: 3, basemap: "streets", slider: true, //default sliderPosition: "top-left" //default }); ready(function (){ on(map, "load", drawPath); on(map, "click", function(evt){ if (evt.graphic) { console.log("Graphic Object:", evt.graphic); console.log("Spatial Reference Object:", evt.graphic.geometry.spatialReference); console.log("type:", evt.graphic.geometry.type); console.log("wkid:", evt.graphic.geometry.spatialReference.wkid); console.log("X:", evt.graphic.geometry.x); console.log("Y:", evt.graphic.geometry.y); } }); function drawPath(){ var polylineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 3); var polylineJson = { "paths":[[[-122.68,45.53], [-122.58,45.55], [-122.57,45.58],[-122.53,45.6]]], "spatialReference":{"wkid":4326}}; var polyline = new Polyline(polylineJson); var polylineGraphic = new Graphic(polyline, polylineSymbol, null, null); map.graphics.add(polylineGraphic); var pSymbol = new SimpleMarkerSymbol().setStyle(SimpleMarkerSymbol.STYLE_CIRCLE).setColor("#FFFF00"); var pnt = new Point(-122.58, 45.55, new SpatialReference(4326)); var pointGraphic = new Graphic (pnt, pSymbol); map.graphics.add(pointGraphic); try{ var testSymbol = new SimpleMarkerSymbol().setStyle(SimpleMarkerSymbol.STYLE_CIRCLE).setColor("#FF0000"); var testPoint = new Point(201394.01178484457, 173661.08635829584, new SpatialReference({wkid:26973}); var testGraphic = new Graphic (testPoint, testSymbol); map.graphics.add(testGraphic); }catch(e){ console.log(e); } } }); }); </script> </head> <body class="claro"></body> </html>
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>Build your first application</title> <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.8/js/esri/css/esri.css"> <style type="text/css"> html, body, #map { padding: 0; margin: 0; height: 100%; } #HomeButton { position: absolute; top: 95px; left: 20px; z-index: 50; } </style> <script src="http://js.arcgis.com/3.8/"></script> <script> var map; require([ "esri/map", "esri/dijit/HomeButton", "dojo/ready", "dojo/on", "esri/geometry/Polyline", "esri/geometry/Extent", "esri/graphic", "esri/symbols/SimpleLineSymbol", "dojo/domReady!" ], function( Map, HomeButton, ready, on, Polyline, Extent, Graphic, SimpleLineSymbol ) { //var ext = new Extent({ xmin: -8614312, ymin: 4687051, xmax: -8536040, ymax: 4730894, spatialReference: { wkid: 102100} }); var map = new Map("map", { basemap: "streets", zoom: 11, center: [-122.67, 45.54]}); var home = new HomeButton({map: map}, "HomeButton"); home.startup(); window.map = map; ready(function (){ on(map, "load", drawPath); function drawPath(){ var polylineJson1 = { "paths":[[[-122.68,45.53], [-122.58,45.55], [-122.57,45.58],[-122.53,45.6]]], "spatialReference":{"wkid":4326}}; var polylineJson2 = { "paths":[[[-122.68,45.53], [-122.58,45.55], [-122.57,45.58],[-122.53,45.6]]], "spatialReference":{"wkid":4326}}; var polyline1 = new Polyline(polylineJson1); var polyline2 = new Polyline(polylineJson2); var polylineSymbolRed = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 9); var polylineSymbolBlue = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0,0,255]), 3); var redLine = new Graphic(polyline1, polylineSymbolRed, null, null); var blueLine = new Graphic(polyline2, polylineSymbolBlue, null, null); map.graphics.add(redLine); map.graphics.add(blueLine); } }); }); </script> </head> <body class="claro"> <div id="map"> <div id="HomeButton"></div> </div> </body> </html>
The "..." means more data. There are hundreds of pairs. You can eliminate the "..." and test others only. Thank.var polylineJson = { 'paths': [ [[201394.01178484457,173661.08635829584],[201392.0117168416,173661.08690949593], [ 201388.01158083565, 173661.08801189612 ], [ 201386.01151283266, 173661.08856309619 ], [ 201384.0114448297, 173661.08911429628 ], [ 201382.0113768267, 173661.08966549637 ], [ 201380.01130882374, 173661.09021669647 ], [ 201378.01124082075, 173661.09076789653 ]] ] };
Data are like that: var polylineJson = { 'paths': [ [ [ 201394.01178484457, 173661.08635829584 ], [ 201392.0117168416, 173661.08690949593 ], [ 201390.01164883861, 173661.08746069603 ], ... ] ] };Thanks.
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>Build your first application</title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/esri/css/esri.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.5/js/dojo/dijit/themes/claro/claro.css" /> <style type="text/css"> html, body, #map { padding: 0; margin: 0; height: 100%; } </style> <script src="http://js.arcgis.com/3.7/"></script> <script> var map; require(["esri/map", "dojo/ready", "dojo/on", "esri/geometry/Polyline", "esri/graphic", "esri/symbols/SimpleLineSymbol", "dojo/domReady!"], function(Map, ready, on, Polyline, Graphic, SimpleLineSymbol) { var map = new Map("map", { center: [-122.67, 45.54], //longitude, latitude zoom: 12, basemap: "streets", slider: true, //default sliderPosition: "top-left" //default }); ready(function (){ on(map, "load", drawPath); function drawPath(){ var polylineJson = { "paths":[[[-122.68,45.53], [-122.58,45.55], [-122.57,45.58],[-122.53,45.6]]], "spatialReference":{"wkid":4326}}; var polyline = new Polyline(polylineJson); var polylineSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 3); var g = new Graphic(polyline, polylineSymbol, null, null); map.graphics.add(g); } }); }); </script> </head> <body class="claro"> <div id="map"></div> </body> </html>
map.graphics.add(new esri.Graphic(polyline, polylineSymbol, null, null));
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.