[mapserver-users] How to add point based on User interaction using C#

Pietro Giannini pgiannini at bytewise.it
Fri Nov 28 10:35:14 EST 2008


Hi Venkat.

I found this tutorial very useful:

http://www.paolocorti.net/public/wordpress/index.php/2006/09/20/mapserver-tutorial-for-c-mapscript-asp-net/

It is exactly what you want, unfortunately it is not reachable now, maybe
a temporary server failure...

I made the same in php_mapscript, db was mysql. You have to do the porting:

___________________________________________________

// get the click point in pixel coordinates
// the imagebutton of the map is named "mapimg"
$clickX = $_REQUEST["mapimg_x"];
$clickY = $_REQUEST["mapimg_y"];

// create a pointobject and store coordinates in projected units
$ppPoint = ms_newpointobj();
$ppPoint->setXY(($oMap->extent->minx + ($oMap->cellsize * $clickX)),
                           ($oMap->extent->maxy - ($oMap->cellsize *
$clickY)));

// create a lat lon projection
$olatlonProj = ms_newprojectionobj("proj=latlong,ellps=WGS84");

// get the map projection
$osProj = $oMap->getProjection();
$omapProj = ms_newprojectionobj($osProj);

// project the point in EPSG 4326, latlon wgs84
$ppPoint->project($omapProj,$olatlonProj);

// insert
$sql = "INSERT INTO pushpins (lon,lat) VALUES ";
$sql .= "(".$ppPoint->x.",".$ppPoint->y.")";
$myconn = mysql_connect(mysql_host,mysql_user,mysql_pw);
mysql_select_db(mysql_db);
$res = mysql_query($sql);

// all done.
// only now redraw the map
$oImage = $oMap->draw();
$sImageUrl = $oImage->saveWebImage();
___________________________________________________


I hope this is useful

ciao
....................................... pg




On Ven, Novembre 28, 2008 09:09, Venkat Rao Tammineni wrote:
> Dear All,
>
>
>
>    I want  to add point based on user click on the map.That point has to
> store in Postgresql/PostGIS.Is there anyone has done the same task.Please
> help me.
>
>
>
> It is urgent for me .please any can help me.or please guide me .
>
>
>
> I am waiting for your great response.
>
>
>
>
>
> Advanced Thanks
>
> Venkat.
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>




More information about the mapserver-users mailing list