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

Venkat Rao Tammineni vtammineni at roulacglobal.com
Mon Dec 1 19:55:57 PST 2008


Hi, Pietro Giannini,


  Thanks for great response. I have already done with my task.

Thanks
Venkat.

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Pietro
Giannini
Sent: Friday, November 28, 2008 9:05 PM
To: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] How to add point based on User interaction
using C#

Hi Venkat.

I found this tutorial very useful:

http://www.paolocorti.net/public/wordpress/index.php/2006/09/20/mapserver-tu
torial-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
>


_______________________________________________
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