Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ShapeFiles (.shp,shx,dbf) position
Message
De
16/05/2001 06:00:02
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00507078
Message ID:
00507719
Vues:
11
>Hello people, someone works with Shapefiles (.shp) ?, i dont know how obtain the position from a part of the shape, i work with ASPMAP Activex and all works fine , my trouble is when i want add a point and the x,y coordinates work for one shape (usa.shp) but dont work for my shape (peru.shp), the strange for me is this point work fine with usa.shp but in my shape dont show me nothing but dont send me errors, how is the position in shape files?
>
>thanks
>
>Francisco Morosini

Francisco,
What is x,y ? Are they pixels, mapunits or real coordinates ?
Maybe x,y are real coordinates that falls outside of Peru map. To obtain position from a point on map you could do this :
*Map activex mousedown
Lparameters button, shift, x, y
With this
 pt    = .ToMapPoint(x, y) && Point where clicked
 pt1   = .ToMapPoint(0, 0) && Upper left corner
 pt2   = .ToMapPoint(.Width, .Height) && Bottom right
 oRect = .TrackPolygon    && Track a rectangle
 lnA   = oRect.Area       && Get area of rect
 lnP   = oRect.Perimeter  && Get perimeter of rect
 pt3   = oRect.Center     && Get center point
             
messagebox( "Coordinates (map units): " + chr(13)+chr(10)+;
    "Clicked :"+transform(pt.X) + "," +transform(pt.Y)+ chr(13)+chr(10)+;
    "Upper-left :"+transform(pt1.X) + "," +transform(pt1.Y)+ chr(13)+chr(10)+;
    "Bottom-Right :"+transform(pt2.X) + "," +transform(pt2.Y)+ chr(13)+chr(10)+;
    "Rectangle :"+chr(13)+chr(10)+;
    " Area :"+transform(lnA)+chr(13)+chr(10)+;
    " Perimeter :"+transform(lnP)+chr(13)+chr(10)+;
    " Center at :"++transform(pt3.X) + "," +transform(pt3.Y) )
endwith
Directly browsing a shp file lowlevel would be too cumbersome IMHO. As long as you have the shape you could get its properties (points, parts, intersection, center, depth etc) through object model. Also you could query if your x,y is in your map space using IsPointIn. To do that create a polygon same as your map.extent (which in fact a rectangle), create a point object with x,y set to your x,y than execute oPoly.IsPointIn(point).
Maybe you should check that point when both US and Peru is part of map (ie: world or America map).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform