MapWindow Home
Search MapWindow.org


  • Home
    • Download
    • Why MW
    • FAQ
    • Contact
  • Products
    • MapWindow
    • ActiveX
    • Plug-ins
  • Software Dev
    • Sample Code
    • Scripts
    • Source
    • Bugs
    • Support
    • Languages
  • Site Tools
    • Forums
    • Tutorials
    • Mailing Lists
    • Team
    • Site Stats
    • Links
  • Get Stuff
    • Buy a CD
    • Buy a T-Shirt
    • MW Book
    • ActiveX Book
    • Donate
    • Buy Support
  • Documentation
    • MWGIS App. User Guide
    • GISTools User Guide
    • MW Plug-ins Dev. Guide
    • MWGIS ActiveX Dev. Guide
    • MWGeoProc Dev. Guide

MapWinGeoProc:SpatialReference ProjectPoint

From MapWindow GIS

Jump to: navigation, search

ProjectPoint

Syntax

 bool ProjectPoint(ref double x, ref double y, string srcPrj4String, string destPrj4String)

Summary

Projects a 2D point from one coordinate system to another
using Proj.4 function: pj_transform.

Parameters

x X value of point to project.
y Y value of point to project.
srcPrj4String Source projection string (proj4 format)
destPrj4String Destination projection string (proj4 format)

Returns

True if projection was successful, false if an error was encountered.

Visual Basic Net 2005 Example Implementation Code

(Using MapWinGIS) (Using MapWinGeoProc) 'Past this code at the beginning of your form or class

   Imports System.IO
   Imports MapWinGeoProc.SpatialReference

'Inside the function write:

      
  Dim sh As MapWinGIS.Shapefile = AxMap1.get_GetObject(AxMap1.get_LayerHandle(i))
  Dim RijksDriehoekString = "+proj=stere +lat_0=52.156160556 +lon_0=5.387638889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=593,26,478,0,0,0,0 +units=m +no_defs"
  Dim WGS84String As String = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
 
             For j = 0 To sh.NumShapes - 1
             Dim shape As MapWinGIS.Shape
              shape = sh.Shape(j)
                Select Case shape.ShapeType
 
                   Case MapWinGIS.ShpfileType.SHP_POINT 'shape is a point
                         Dim pnt As MapWinGIS.Point = shape.Point(0)
                         s.WriteLine("<Point>")
                         Dim nX As Double = pnt.x
                         Dim nY As Double = pnt.y
                         Dim nZ As Double = pnt.Z
                         
                         'Dim WGS84String As String = "+proj=utm +zone=12 +ellps=WGS84"
                         ProjectPoint(nX, nY, RijksDriehoekString, WGS84String)
                         'At this point in the loop nX and nY hold the values in the WGS84 coordinatsystem
                         
                 End Select
             Next
Retrieved from "http://www.mapwindow.org/wiki/index.php/MapWinGeoProc:SpatialReference_ProjectPoint"
Views
  • Page
  • Discussion
  • View source
  • History
Personal tools
  • Log in / create account
  • What links here
  • Related changes
  • Upload file
  • Special pages
  • Printable version
  • Permanent link

Geospatial Software Lab

Copyright © 2008 - MapWindow Open Source Team
( last updated: November 12 2008.)
Home | Donate | Download | MapWindow GIS Desktop | MapWinGIS.ocx | Plug-ins | Contact | Lists | Bugs | Sample Code | Documentation
Code Repository | Open Source License | Discussion Forum | Wiki | Join the Team | Site Statistics | Links