POST
|
Hi folks, I've been trying to figure out a good way for a while now to duplicate some behavior that I've got in a google maps environment using ArcGIS. I have a map which is populated with a bunch of points using PictureMarkerSymbols. Each of those points has an attribute containing HTML with a bit of extra information. When using google maps, we were populating an info box with that html and displaying it under the PictureMarkerSymbol. I'm trying to figure out the best way to do this with this API. I've tried using TextSymbols by breaking up the HTML (splitting it on <br> and making a new TextSymbol for each line), but without a background for the TextSymbols, they're basically unreadable much of the time. I've also tried creating a div with the html, placing it under the PictureMarkerSymbol and adding event handlers to the map for drag and such to reposition it any time map movement occurs, but the box moves around blockily and isn't smooth at all. I don't think I can use InfoWindows since you normally only have one per layer and I can have multiple points which will need labels underneath. I've been thinking about trying to extend and create a custom symbol, but I haven't seen any documentation or resources about how to do this against the JavaScript API. If anyone can point me in the right direction, I'd really appreciate it! Thanks!
... View more
08-07-2013
10:43 AM
|
0
|
0
|
567
|
POST
|
I think this is more of a javascript problem than an ESRI one. If I were you, I would change the way you keep track of your wells. Instead of using an index in an array, maybe you could try using a dictionary and organizing by well name? (I'm assuming that the name you're using in your dropdown selection is the well name) Try this... var gmarkers = {}; gmarkers[site_name] = graphic; And then when you click an item in the dropdown menu, you can use the site name instead of the selection index, since the selection index doesn't always correspond to the right value in the gmarker array. Additionally, since gmarkers is just full of graphics, you can get the graphic's geometry property to get the point that you need, rather than having to populate your option list with it and parse it from there. <form style="margin-top:2px;margin-bottom:10px;" action=""> <select name="delta" onchange="javascript:reveal_site(this)"> <option value="">Select a well</option> <option value="0,47.076611,-122.127667">18N/05E-02H02</option> <option value="1,47.078417,-122.170528">18N/05E-04A01</option> <option value="2,47.076667,-122.195861">18N/05E-05G03</option> <option value="3,47.081361,-122.212056">18N/05E-06A02</option> <option value="4,47.064722,-122.207417">18N/05E-08D06</option> ... </select> </form> function reveal_site(i) { var site_name = i.options[d.selectedIndex].innerHTML; var gmarker = gmarkers[site_name]; var point = gmarker.geometry; point = esri.geometry.geographicToWebMercator(point); map.infoWindow.setTitle(gmarker.getTitle()); map.infoWindow.setContent(gmarker.getContent()); map.infoWindow.show(point, point); I hope that this makes sense and helps you!
... View more
08-02-2013
12:28 PM
|
0
|
0
|
283
|
POST
|
That was the problem! I was defining the polyline with the basemap's spatial reference, but the points I was using were all using the default of 4326. Once I defined the polyline with that same reference, it worked. I don't understand spatial references very well, so I didn't realize that the two weren't compatible! Thanks for the prompt reply and the good advice!
... View more
07-29-2013
08:58 AM
|
0
|
0
|
295
|
POST
|
Hi everyone, I have a problem that I'm hoping one of you can help me with. I've got a bunch of PictureMarkerSymbols, and I want to draw lines between them and a single other PictureMarkerSymbol. I've got all of the necessary coordinates, and I'm not seeing any errors when I create the appropriate objects. However, none of the lines I'm creating are being displayed on the map. I'll post a part of the code below, please let me know if you have any idea what might be wrong! var polylineSymbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([204, 102, 51]), 4); path = $.map(line.points, function(point) { p = new esri.geometry.Point(point.lng, point.lat); return p; }); polyline = new esri.geometry.Polyline(map.spatialReference); polyline.addPath([path[0], path[1]]); map.graphics.add(new esri.Graphic(polyline, polylineSymbol)); Thanks!
... View more
07-29-2013
07:34 AM
|
0
|
3
|
723
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|