Select to view content in your preferred language

Open viewer centered at coordinates passed in URL parameters and display marker

3847
6
Jump to solution
12-12-2013 07:42 AM
RichardButgereit
Regular Contributor
I would be sure that somebody has probably already addressed this one -- but I have searched and can't find it.

I need to open the Viewer centered at coordinators passed in the URL parameters AND display a marker at that location.

Out-of-the-box the viewer includes passing "center=" in the URL parameters to do such, but does not include displaying a marker at that location.

Also, of course, I want to pass in Lat/Long coordinates in decimal degrees -- so I'll have to handle reprojecting.

Has anybody else tackled this one already? Any body have any sample code they could provide?

I am working in MapManager.mxml, but so far not having any luck adding the graphic marker.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RichardButgereit
Regular Contributor
I got the code written to accomplish this -- by modifying MapManager.mxml to add a graphic at the center.

I am having a problem with the infoTemplate for that graphic -- but otherwise, this is working pretty well.

Essentially I followed the same steps Locate follows to place the graphic.

View solution in original post

0 Kudos
6 Replies
AnthonyGiles
Honored Contributor
The viewer will handle coordinates in the URL that are not in the same spatial reference as the application, you just need to specify the wkid in the URL, eg:

http://www.example.com/flexviewer/index.html?center=103.87,1.31,4326&level=8


This URL tells the application that the coordinates are in wkid 4326 for geographic / decimal degrees.

To put a point at the location would require you to some custom coding, there is nothing out of the box to do this.

Regards

Anthony
0 Kudos
RichardButgereit
Regular Contributor
I got the code written to accomplish this -- by modifying MapManager.mxml to add a graphic at the center.

I am having a problem with the infoTemplate for that graphic -- but otherwise, this is working pretty well.

Essentially I followed the same steps Locate follows to place the graphic.
0 Kudos
NiallBrosnan
Deactivated User
Hello,

By any chance could I get a look at the code you wrote to add the below graphic?

Thanks,

Niall

I got the code written to accomplish this -- by modifying MapManager.mxml to add a graphic at the center.

I am having a problem with the infoTemplate for that graphic -- but otherwise, this is working pretty well.

Essentially I followed the same steps Locate follows to place the graphic.
0 Kudos
RichardButgereit
Regular Contributor
The viewer will handle coordinates in the URL that are not in the same spatial reference as the application, you just need to specify the wkid in the URL, eg:

http://www.example.com/flexviewer/index.html?center=103.87,1.31,4326&level=8


This URL tells the application that the coordinates are in wkid 4326 for geographic / decimal degrees.

To put a point at the location would require you to some custom coding, there is nothing out of the box to do this.

Regards

Anthony


Thank you, Anthony...I had totally overlooked that the wkid could be passed in, and thought I had to code to handle that. Seeing that it was already addressed made the rest of the work easy.
0 Kudos
RichardButgereit
Regular Contributor
Hello,

By any chance could I get a look at the code you wrote to add the below graphic?

Thanks,

Niall


Full code is attached...sorry, I didn't adds comments throughout indicating what I had added...you'll just to have compare/contrast with original code to determine.
0 Kudos
NiallBrosnan
Deactivated User
Thats great. Thanks for that.

Will take a look at it today.

Niall
0 Kudos