HI,
I want to change my map coordinates to WGS_1984_UTM_Zone_23S Format. So when mouse move in map this coordinate display in Div Tag.
So how can I change coordinate to this format?
Convert Coordinates to WGS_1984_UTM_Zone_23S
Hi Vivek,
There is no way to do this conversion on client side, the only option is do the conversion on server side using Proj4Projection and then pass the converted coordinate to click to display, following is some codes:
PointShape p = ExtentHelper.ToWorldCoordinate(winformsMap1.CurrentExtent, e.X, e.Y, winformsMap1.Width, winformsMap1.Height);
Proj4Projection projection =
new
Proj4Projection();
projection.MemoryMode = Proj4MemoryMode.Unmanaged;
projection.ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(32723);
projection.InternalProjectionParametersString = Proj4Projection.GetWgs84ParametersString();
projection.Open();
PointShape p1 = projection.ConvertToExternalProjection§
as
PointShape;
Thanks,
Johnny
Thanks Johnny…
I use this code and quite useful for me.
I also ask one question that,
How can I zoom the map where marker is put.
I have records in table, when I click on particular record it display marker at particular position,
Now I want to zoom where marker is display,
So how can I do that??
Hi Vivek,
You can zoom to target marker like this:
Marker yourMarker;
Map1.ZoomToMarkers(new Collection<Marker>() { yourMarker });
Regards,
Don
Thanks Don,
I added marker as,
Dim x, y As Double
Dim markerId As String
If Not IsNothing(map) Then
markerId = args("markerId").ToString()
x = CDbl(args("x"))
y = CDbl(args("y"))
Dim markerOverlay As InMemoryMarkerOverlay = map.CustomOverlays("MarkerOverlay")
If Not markerOverlay.FeatureSource.InternalFeatures.Contains(markerId) Then
Dim proj10 As Proj4Projection = New Proj4Projection()
proj10.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(32723)
proj10.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString()
proj10.Open()
map.MapUnit = GeographyUnit.Meter
markerOverlay.FeatureSource.Projection = proj10
markerOverlay.FeatureSource.InternalFeatures.Add(markerId, New Feature(x, y))
I pass x and y value from View via Javascript.
So what value I should pass in yourmarker value?
Marker yourMarker;
can you give me some demo example??
Thanks in Advance
Hi Vivek,
Sorry I don’t know what you are pass in, so I just use a simple API for zoom to marker.
It’s not easy for me to write MVC code in VB.net, so I still will give you a simple code snippet about how to use zoom to related API.
If you still cannot get how to use them, I will build a C# sample for you about that.
If you want to zoom to marker via JavaScript, please use our SetCenter(longitude, latitude) API.
You can find more help here:
thinkgeo.com/forums/MapSuite/tabid/143/aft/5616/Default.aspx
If you want to did that in server side, you can call this API:
map.CenterAt(x, y);
if you want to zoom to a better level and you know the target scale:
PointShape centerPoint = new PointShape(x, y);
map.ZoomTo(centerPoint, targetScale);
Wish that’s helpful.
Regards,
Don
Thanks Don and sorry for late reply.
I still don’t get Zoom on marker.
So if it possible can you give me demo example in vb.net or c#??
Hi Vivek,
I created a sample for your, please check the attached files.
Hope it helps.
Regards,
Troy
post11918.zip (1.38 KB)
Thank you so much Troy,
Its work…
Thanks…
Vivek,
You are welcome.
Any questions, don’t hesitate to let us know.
Thanks,
Troy