Google Basemap in JavaScript app

3567
14
05-07-2012 08:41 AM
ChrisDickerson
New Contributor
Hey I'm new at JavaScript coding and I've gotten stuck in a project that I'm working on.   I working on using a Google basemap with some operational feature layers.  There is supposed to be a zoom to feature from a list, but it isn't working all that well.  When I click some items it works, but others are taking me to the middle of Africa rather than where it should be in Milwaukee.  It recently came to my attention that I may need to change my spatial reference.

I'm wondering if someone might be able to tell me what spatial reference "wkid" code to use with a Google basemap.

thanks
0 Kudos
14 Replies
ChristopherPollard
Occasional Contributor
Chris,
I added your map service into the zoom to datagrid ESRi sample:
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/fl_zoomgrid.ht...

Zooming to buildings work for some but not all.. it seems like some of the building from the map service are not drawing correct?
Clicking on Downer Woods,Engleman Stadium and a few others does nothing.

Your best bet is to try a get the ESRI sample to work 1st with your data and map service before you try and mash it into the sample with Google Basemap Sample.
When I first starting working with the ArcGIS API for Javascript I would find the sample and functionality that I wanted and modify the code/map service to use my data.
Once I had all the samples that I needed I would then build my web application from mashing together the samples and functionality that I needed for the web app.
This might help you get used to working with the code, samples as well as writing and understanding javascript....

Good luck,

FYI.. my sample code doesn't include the zoom to button image..
0 Kudos
ChrisDickerson
New Contributor
Thanks

And what you said is exactly what I've been doing here are three aspects of my code.  Test is the data grid with an esri base working. The one with _working in the title is the application with out the data grid and the other is the attempt on combining.

If you can give me any tips on cleaning up my code and suggestions would be appreciated.

Thanks for the example.
0 Kudos
ChristopherPollard
Occasional Contributor
Chris,
I looked at your code and line 124 needed a ";"
I also added all the map layers because line 381 was looking for them and couldn't find those objects.

line 387:
I added a
console.log (buildingExtent);

if you open firefox and use firebug this will log for you the values that are being returned when the user clicks on the zoom button for each layer.

Like I mentioned there are some layers which seem to not exist or have any extent and if use view there values in firebug you can see which ones have issues.

I think the added global varibles helped fix the zoom to error, once I added them it seems like it didn't zoom to Africa...

Keep me posted and what you have built so far looks great..
0 Kudos
ChrisDickerson
New Contributor
Thanks for help that seems to be working. 
The issue with the items that don't get zoomed too are they are too small to be zoomed too and they are also not represented on the map.
By chance do you have any idea to link my info Windows to the click event in the data grid?

Thanks again this has been a big help.
Chris
0 Kudos
ChristopherPollard
Occasional Contributor
try to run the executeIdentify in the
zoomRow (id) function after
map.setExtent(buildingExtent);
executeIdentify(feature.extent?? or something like this)


Search the forums for a topic related to:
"geocode and then identify/query"
0 Kudos