Select to view content in your preferred language

centerandzoom & onClick event mappoint spatialreference null

2022
11
09-17-2010 08:07 AM
GlenRhea
Emerging Contributor
I have a "zoom to county" drop down that uses centerandzoom which works great however all my onclick events fail when I use the zoom because mappoint spatialreference is null until I pan the map. Once I pan the map all my onclick events work fine.

This issue also affects another function that uses centerandzoom but displays a layer instead. The layer doesn't show up until I pan a little.

There is too much code to post so here is a link to the app:
http://dev.geostor.arkansas.gov/G6/Viewer.html

All my code is in http://dev.geostor.arkansas.gov/G6/js/Viewer.js and the two functions I'm referring to are zoomCounty() and xyZoom()

Thanks for your time,
Glen
0 Kudos
11 Replies
derekswingley1
Deactivated User
Hi Glen,

I took a look but I'm not quite clear on what specifically is failing. Can you elaborate?

Thanks.
0 Kudos
derekswingley1
Deactivated User
OK, I see what you're describing. I think this is where you're spatialReference is getting screwed up:
var pnt = new esri.geometry.Point(Number(temp[0]),Number(temp[1],new esri.SpatialReference({ wkid: 26915})));


You've got a paren out of place. Add a closing paren after your second Number() function call on line 598 and take one off of the end of that line in viewer.js.
0 Kudos
GlenRhea
Emerging Contributor
That's what I tried to do but I couldn't find any way to populate that for a mappoint. I may go ahead and call support but I usually figure it out right after I call them 😞
0 Kudos
derekswingley1
Deactivated User
Edited my previous post...just posting here so you get a notification that the thread was updated.
0 Kudos
GlenRhea
Emerging Contributor
Nice catch! Yep that fixed it, been looking for that one (off and on) for awhile.

I appreciate your help!

Glen
0 Kudos
GlenRhea
Emerging Contributor
I know it's working now but IMO it shouldn't send a null spatial reference just because I use centerandzoom...

ESRI, you listening?
0 Kudos
derekswingley1
Deactivated User
Glad to help!

I'm guessing someone from Esri will see this but what do you want them to do? I mean, the problem was a syntax error in your code. Granted, it resulted in the API acting kind of strange but the source of the issue was your code. Maybe you should still contact support if you think this is a legitimate bug.
0 Kudos
GlenRhea
Emerging Contributor
I put the spatial references in there to make it work because the events were showing null after I used centerandzoom.

I don't think you should have to manually re-define the spatial reference just because you use centerandzoom, it should still be defined and not null.

In my mind, that's a bug...
0 Kudos
derekswingley1
Deactivated User
Here's the doc for esri.geometry.Point:  http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/point.htm

Spatial reference is listed as required...
0 Kudos