Select to view content in your preferred language

Project Point Conflicting with Identify Task

909
8
05-23-2012 11:48 AM
ChrisSergent
Regular Contributor III
I have an identify button and a project point button. If I click on Identify and then click on the map, Identify works fine, but if I click on the project point button, the project point works, but my Identify stops working. I have included a video to explain:
http://youtu.be/RRhQwS8sxaM

I have also posted the code on github at:
https://github.com/csergent45/SOA-Final

reactor.js within the js folder is where the bulk of the code that runs this application, but all the code that has to with identify and projecting the point are in this file.

Thanks.

Chris S.
0 Kudos
8 Replies
JeffPace
MVP Alum
I have an identify button and a project point button. If I click on Identify and then click on the map, Identify works fine, but if I click on the project point button, the project point works, but my Identify stops working. I have included a video to explain:
http://youtu.be/RRhQwS8sxaM

I have also posted the code on github at:
https://github.com/csergent45/SOA-Final

reactor.js within the js folder is where the bulk of the code that runs this application, but all the code that has to with identify and projecting the point are in this file.

Thanks.

Chris S.


well your project deactivates the identifyhandle, do you ever reactivate it?
0 Kudos
ReneRubalcava
Frequent Contributor II
Area you able to verify via console.log or Chrome debug tools that the identifyParams are still correct after you run the project point? I would console.log the whole path of execution to find out where something is not firing.
I glanced over the code, but nothing glaring seems to stick out.
0 Kudos
ChrisSergent
Regular Contributor III
well your project deactivates the identifyhandle, do you ever reactivate it?


The runIdentify() function reactivates it when the user clicks the Identify button. It works fine with the measure line button.
0 Kudos
ChrisSergent
Regular Contributor III
Area you able to verify via console.log or Chrome debug tools that the identifyParams are still correct after you run the project point? I would console.log the whole path of execution to find out where something is not firing.
I glanced over the code, but nothing glaring seems to stick out.


How would I do that -->> I would console.log the whole path of execution
0 Kudos
ChrisSergent
Regular Contributor III
I ended up removing this block of code:
ptGraphic.setInfoTemplate(new esri.InfoTemplate("Coordinates",
        "<p> X: " + point.x +
        "<br/> Y: " + point.y +
        "</p>" +
        "<input type='button' value='Convert back to LatLong' onclick='projectToLatLong();' />" +
        "<div id='latlong'></div>"));
        map.infoWindow
            .setTitle(ptGraphic.getTitle())
            .setContent(ptGraphic.getContent())
            .show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));

apparently, the infoWindows conflicted with one another. I just set the x and y coordinates to fields on the web page.
0 Kudos
ReneRubalcava
Frequent Contributor II
I dl'd your project and just added console.log("methodname", evt); and various other items to console.log and various other items as I followed what methods were being executed. I think I found what your problem is.

You are using a div in your aspx page to hold the infoWindow contents for identify.
            <!-- Identify Window Begin -->
            <div id="tabs"
                 dojoType="dijit.layout.TabContainer"
                 style="width:385px;height:150px;">
                <!-- Safezone Tab Begin -->
                <div id="safeZoneTab"
                      dojoType="dijit.layout.ContentPane"
                      title="Location">
                </div>
                <!-- Safezone Tab End -->
            </div>
            <!-- Identify Window End -->


When you project your point, you are setting up new content for the map infowindow for the projected data. It looks like this is deleting the "tabs" dom element from your page, so it is no longer available the next time you do your identify.

    geometryService.project([point], ptOutSR, function (projectedPoints) {
        point = projectedPoints[0];
        ptGraphic.setInfoTemplate(new esri.InfoTemplate("Coordinates",
        "<p> X: " + point.x +
        "<br/> Y: " + point.y +
        "</p>" +
        "<input type='button' value='Convert back to LatLong' onclick='projectToLatLong();' />" +
        "<div id='latlong'></div>"));
        map.infoWindow
            .setTitle(ptGraphic.getTitle())
            .setContent(ptGraphic.getContent()) // This deleting the "tabs" dom element, if I comment out, id still works, but project results not show
            .show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));
   
    });


I tried to go through and wrap that content in a templating engine, but I'm not fully familiar with the app, so I'm not sure where the changes would need to be made. You might be able to to use dojo.create() to do it manually, but since it's a dojo dijit element, I'm not sure how to make sure it's fully initialized when loaded. You also have the "tabs" dom tied to some other stuff in your app like a map resize it looks like.
0 Kudos
BarraLoubna
New Contributor
Hello,

I'm currently develloper navigation tools like your example and I want to add a Identify button to my toolbar, I would like to know how you added the Identify button, if you may. It's really very urgent

Thank you in advance for your help.
0 Kudos
BarraLoubna
New Contributor
Hello,

I'm currently develloper navigation tools like the example in this page and I want to add a Identify button to my toolbar, I would like to add the Identify feature button in my tolbar. If you may, have you a example?  It's really very urgent

Thank you in advance for your help.
0 Kudos