|
POST
|
Please, no reason to be rude Shaning. Still waiting for Ken to generate a working sample.
... View more
01-10-2014
10:19 AM
|
0
|
0
|
1974
|
|
POST
|
Documentation for result of an IdentifyTask: https://developers.arcgis.com/en/javascript/jsapi/identifyresult-amd.html As you can see, it returns one feature (as a graphic). You've already discovered result.feature.geometry.x and result.feature.geometry.y, but it is all outlined in the documentation. Hope this helps!
... View more
01-10-2014
10:12 AM
|
0
|
0
|
1178
|
|
POST
|
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. Opps! Forgot a ) on this line:
var testPoint = new Point(201394.01178484457, 173661.08635829584, new SpatialReference({wkid:26973}));
... View more
01-10-2014
09:58 AM
|
0
|
0
|
1974
|
|
POST
|
I wrote my own reusable dijit with accompanying template so it's a fairly complex sample to post on here. Found some easier solutions that are less customizable but do nearly the same thing. https://developers.arcgis.com/en/javascript/jssamples/widget_extendInfowindow.html This sample uses a function to populate the content of the InfoWindow/Popup. The function returns HTML that is then populated in each InfoWindow when a feature is selected. Notice how a link ("Wikipedia Entry") is generated based on the feature selected. * * https://developers.arcgis.com/en/javascript/jssamples/popup_chart.html This sample uses the PopupTemplate class to customize the content of an InfoWindow/Popup. Using PopupTemplate is quick but may not offer the ammount of customization you require. (PopupTemplate Documentation: https://developers.arcgis.com/en/javascript/jsapi/popuptemplate-amd.html ) * * https://developers.arcgis.com/en/javascript/jssamples/fl_popup.html This is an older sample (non-AMD) that is similar to the first sample but good for reference. * * If these samples are too simple for your ultimate needs, you should explore writing your own dijit to replace Popup in the context of your application. That's what I ended up having to do to.
... View more
01-10-2014
09:25 AM
|
0
|
0
|
2193
|
|
POST
|
It's not that these coordinate aren't 10200. They're just located very close to 0°N, 0°W Could you take my code and modify it to work with his path by chance? Should be a 5 minute job with the code posted above. Thanks!!!
... View more
01-10-2014
09:06 AM
|
0
|
0
|
3982
|
|
POST
|
@Ken Thank you for your help. You are completely correct. shaningesri made another thread on the topic earlier: http://forums.arcgis.com/threads/99906-Add-graphic-not-successufl It's always been a coordinates issue but I have been unsuccessful in communicating that to shaningesri.
... View more
01-10-2014
09:04 AM
|
0
|
0
|
1042
|
|
POST
|
It's because you are still using points and assigning the wrong spatial reference. 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} }; These points are not 102100. An example of coordinates with a spatial reference of 102100: [-7900279.71, 5103864.38] I tried taking one of your path coordinates and was able to add a point to the map using a spatial reference of 26973 (as you mentioned earlier in the thread) and it was successful. Sample below; click on the points to print data about that point in the console. However, like I said, you will need to convert your data into a usable format. The other potential option is to use a custom basemap with a spatial reference of 26973 (but I feel like this is more work overall).
<!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>
Could you post the latitude and longitude of your coordinates?
... View more
01-10-2014
08:57 AM
|
0
|
0
|
1974
|
|
POST
|
+1 to Ken for both a solid answer and using dgrid in a popup.
... View more
01-09-2014
12:45 PM
|
0
|
0
|
1994
|
|
POST
|
Hi Aleydis! Code seems fine at a quick glance (however, I cannot tell from this code if your external variables are correct...) If its not too much trouble, could you recreate a sample showing the issue using http://jsfiddle.net/ ? On a different note, glad to hear you've migrated to 3.7 from 2.1! There have been been a lot of new and exciting features added since version 2.1; hopefully you find them useful 😃
... View more
01-09-2014
07:20 AM
|
0
|
0
|
1339
|
|
POST
|
Awesome! I'm going to take a closer look. I immediately noticed an error in the console:
TypeError: lyrDefinition is undefined
if (lyrDefinition.parentID == lyrIdx) {...
Might be a clue. Going to play around for a bit. *edit It also looks like each map uses svg layers with the same IDs... so the API is probably getting confused.
<svg id="left_column_gc" overflow="hidden" width="949" height="600" style="overflow: visible; position: absolute;"><g id="gpx_1756_0_layer" transform="matrix(1.00000000,0.00000000,0.00000000,1.00000000,0.00000000,0.00000000)" style="display: none;">
<g id="gpx_1756_1_layer" transform="matrix(1.00000000,0.00000000,0.00000000,1.00000000,0.00000000,0.00000000)" style="display: block;"> ...
<g id="gpx_1756_2_layer" style="display: none;" transform="matrix(1.00000000,0.00000000,0.00000000,1.00000000,0.00000000,0.00000000)"> ...
<svg id="middle_column_gc" overflow="hidden" width="940" height="600" style="overflow: visible; position: absolute;"><g id="gpx_1756_0_layer" style="display: none;">
<g id="gpx_1756_1_layer" transform="matrix(1.00000000,0.00000000,0.00000000,1.00000000,0.00000000,0.00000000)" style="display: block;"> ...
<g id="gpx_1756_2_layer" style="display: none;"> ...
... View more
01-09-2014
06:58 AM
|
0
|
0
|
1170
|
|
POST
|
Here is the code that bgfield posted in a working jsfiddle sample: http://jsfiddle.net/U23kr/ Using the sample, I was able to confirm that graphics sometimes do not show up at extremely close zoom levels. However, after viewing the documentation, it looks like centerAt() returns a deferred. You could probably wait until the centerAt() operation is complete, and use a .then() to add the graphic. If the issue still persists after this change, please let me know.
... View more
01-09-2014
06:19 AM
|
0
|
0
|
1635
|
|
POST
|
Hi Ben! I was trying to troubleshoot this but couldn't create a working sample between not knowing what your HTML looks like and all the jQuery markup. Could you recreate the issue in http://jsfiddle.net/ so I can play around and potentially offer a helpful solution. Thanks!!
... View more
01-09-2014
06:13 AM
|
0
|
0
|
1170
|
|
POST
|
You could create a template for the infoWindow/Popup to generate an html5 form on feature selection. I do something similar in a small app with html5 checkboxes and a submit data button on an infoWindow. [ATTACH=CONFIG]30363[/ATTACH]
... View more
01-08-2014
02:48 PM
|
0
|
0
|
2193
|
|
POST
|
Hey Dave, Can you recreate the issue using http://jsfiddle.net/ ? I'd love to see if this is a valid bug. Thanks!
... View more
01-07-2014
01:00 PM
|
0
|
0
|
2424
|
|
POST
|
It has to do with scope. Your function is not within the global scope, but within the DOJO scope. Instead of having onclick on your html input, just use an on event inside your require block. on(dom.byId("0"), "click", function(evt){ // do something }); ( Also, I would change the id of your input to something other than '0' )
... View more
01-07-2014
12:54 PM
|
0
|
0
|
868
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-26-2014 09:56 AM | |
| 1 | 09-18-2014 11:50 AM | |
| 1 | 09-19-2014 11:28 AM | |
| 1 | 07-09-2014 01:43 PM | |
| 1 | 07-09-2014 02:05 PM |
| Online Status |
Offline
|
| Date Last Visited |
08-14-2024
05:31 PM
|