Loading Polygon Lat/Long Coordinates

Am working with Census 2000 data. I have added coordinates to cen00_state
based on the centroid values in INTPTLAT (latitude) and INTPTLON (longitude).
SQL> describe cen00_state;
Name Null? Type
STUSAB NOT NULL VARCHAR2(2)
REGION NOT NULL VARCHAR2(1)
DIVISION NOT NULL VARCHAR2(1)
STATECE NOT NULL VARCHAR2(2)
STATE NOT NULL VARCHAR2(2)
AREALAND NOT NULL VARCHAR2(14)
AREAWATR NOT NULL VARCHAR2(14)
NAME NOT NULL VARCHAR2(20)
FUNCSTAT NOT NULL VARCHAR2(1)
GCUNI NOT NULL VARCHAR2(1)
POP100 NOT NULL NUMBER(9)
HU100 NOT NULL NUMBER(9)
INTPTLAT NOT NULL VARCHAR2(10)
INTPTLON NOT NULL VARCHAR2(11)
LSADC NOT NULL VARCHAR2(2)
HUD_REGION_ID NOT NULL NUMBER(2)
HUD_REGION_NAME NOT NULL VARCHAR2(11)
CKEY NOT NULL VARCHAR2(2)
STATE_GEO_LOCATION MDSYS.SDO_GEOMETRY
SQL> -- Select state data for New Hampshire
SQL> select * from cen00_state where state = 33;
ST R D ST ST AREALAND AREAWATR NAME F G POP100
HU100 INTPTLAT INTPTLON LS HUD_REGION_ID HUD_REGION_ CK
STATE_GEO_LOCATION(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_O
NH 1 1 12 33 23227265747 988970050 New Hampshire A N 1235786
547024 +43.309253 -071.540147 01 1 Region I 33
SDO_GEOMETRY(2001, 8307, SDO_POINT_TYPE(-71.540147, 43.309253, NULL), NULL, NULL
Metadata dictionary entry...
SQL> select * from user_sdo_geom_metadata where table_name = 'CEN00_STATE'
TABLE_NAME
COLUMN_NAME
DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
SRID
CEN00_STATE
STATE_GEO_LOCATION
SDO_DIM_ARRAY(SDO_DIM_ELEMENT('LONG', -180, 180, .005), SDO_DIM_ELEMENT('LAT', -
90, 90, .005))
8307
Index...
SQL> select * from user_sdo_index_info where index_name like 'CEN00_STATE%';
INDEX_NAME TABLE_NAME
COLUMN_NAME
SDO_INDEX_TYPE SDO_INDEX_TABLE
SDO_INDEX_STATUS
CEN00_STATE_SIDX CEN00_STATE
STATE_GEO_LOCATION
RTREE MDRT_37FFD$
VALID
SQL> -- Query example
SQL> -- How close are the New England states to New Hampshire (centroid)?
SQL> select /*+ordered*/
a.name,sdo_geom.sdo_distance (a.state_geo_location, b.state_geo_location,
.005,'unit=MILE') distance_in_miles
from cen00_state b, cen00_state a
where b.state = 33 and a.state <> 33
and sdo_within_distance (a.state_geo_location,b.state_geo_location,
'distance = 150 unit=MILE') = 'TRUE'
order by distance_in_miles
NAME DISTANCE_IN_MILES
Massachusetts 74.4552857
Vermont 75.246055
Rhode Island 109.036884
Maine 139.790842
Connecticut 139.841283
Since the coordinates are the centroid location within a particular
geographic level, I want to store the polygons. For the Census 2000
table cen00_anrc:
SQL> describe cen00_anrc;
Name Null? Type
STATE NOT NULL VARCHAR2(2)
ANRC NOT NULL VARCHAR2(5)
ANRCCC NOT NULL VARCHAR2(2)
AREALAND NOT NULL VARCHAR2(14)
AREAWATR NOT NULL VARCHAR2(14)
NAME NOT NULL VARCHAR2(90)
FUNCSTAT NOT NULL VARCHAR2(1)
GCUNI NOT NULL VARCHAR2(1)
POP100 NOT NULL NUMBER(9)
HU100 NOT NULL NUMBER(9)
INTPTLAT NOT NULL VARCHAR2(10)
INTPTLON NOT NULL VARCHAR2(11)
LSADC NOT NULL VARCHAR2(2)
CKEY NOT NULL VARCHAR2(7)
ANRC_GEO_LOCATION MDSYS.SDO_GEOMETRY
I obtained the polygon coordinates from the Census Bureau for the ANRC geography.
The data was loaded into a table:
SQL> describe poly_4pt;
Name Null? Type
STATE VARCHAR2(2)
ANRC VARCHAR2(5)
GID VARCHAR2(32)
GEOMETRY MDSYS.SDO_GEOMETRY
An example query:
SQL> select * from poly_4pt where gid = 68;
ST ANRC GID
GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
02 01570 68
SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARR
AY(173.602191, 52.444285, 173.732254, 52.5124549, 173.73627, 52.512422, 173.7695
03, 52.512072, 173.772799, 52.509905, 173.772402, 52.506877, 173.766595, 52.5032
94, 173.754979, 52.496127, 173.739385, 52.493257, 173.722218, 52.4846423, 173.70
7741, 52.477377, 173.700056, 52.4655878, 173.695719, 52.458935, 173.691601, 52.4
45935, 173.69386, 52.438694, 173.702252, 52.434804, 173.704299, 52.432192, 173.7
12323, 52.421033, 173.719161, 52.397703, 173.725102, 52.360316, 173.725696, 52.3
56579, 173.722229, 52.3565693, 173.651293, 52.35637, 173.644793, 52.357598, 173.
640825, 52.359428, 173.606767, 52.378249, 173.595397, 52.391893, 173.593253, 52.
3948411, 173.588794, 52.400973, 173.562061, 52.4011506, 173.559891, 52.401165, 1
73.559254, 52.4008288, 173.556548, 52.3994015, 173.543778, 52.392666, 173.539462
, 52.3916242, 173.512162, 52.385035, 173.503009, 52.384534, 173.495585, 52.38412
77, 173.483843, 52.383485, 173.475268, 52.3840144, 173.465442, 52.384621, 173.45
5586, 52.389656, 173.3955, 52.402647, 173.385704, 52.404072, 173.36964, 52.40396
09, 173.362396, 52.4039108, 173.356927, 52.403873, 173.356103, 52.405563, 173.38
0058, 52.431843, 173.440111, 52.453664, 173.445696, 52.455031, 173.467698, 52.44
4473, 173.476243, 52.441909, 173.485468, 52.4415431, 173.490265, 52.4413527, 173
.496641, 52.4410998, 173.501022, 52.440926, 173.525161, 52.448137, 173.530105, 5
2.449968, 173.550002, 52.467067, 173.549605, 52.469989, 173.545302, 52.476, 173.
555739, 52.479472, 173.556228, 52.4794307, 173.562814, 52.4788745, 173.587554, 5
2.476785, 173.597091, 52.4847036, 173.623883, 52.506948, 173.680586, 52.512878,
173.732254, 52.5124549))
Now I want to load the polygons into cen00_anrc doing a join between
poly_4pt and cen00_anrc with anrc as the join field. After a number
of attempts to do so I am received an error saying that the SRID criteria
doesn't match at various levels. Unfortunately I can't seem to reconstruct
the query that I was using earlier to get to the point where I was
getting the SRID error.
Questions:
- Can I store polygons as lat/long coordinates? If affirmitive, then
what are the proper values for the header information for SDO_GEOMETRY?
- What is the most efficient SQL update command to load the polygons from
the poly_4pt table into the cen00_anrc table?
Thank you for any assistance.

I have further narrowed down the problem. It is the way the sdo_geometry and sdo_elem_info_array information is being placed in the data flow within the sqlldr control file. If I leave out the '8307' SRID value thusly:
LOAD DATA
INFILE *
TRUNCATE
CONTINUEIF NEXT(1:1) = '#'
INTO TABLE POLY_4PT
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS (
STATE CHAR,
ANRC CHAR,
GID INTEGER EXTERNAL,
GEOMETRY COLUMN OBJECT
SDO_GTYPE INTEGER EXTERNAL,
SDO_ELEM_INFO VARRAY TERMINATED BY '|/'
(elements FLOAT EXTERNAL),
SDO_ORDINATES VARRAY TERMINATED BY '|/'
(ordinates FLOAT EXTERNAL)
begindata
02|03950|1|2003|1|1003|1|/
#-0.153395741022000E+03|0.679530269228395E+02|
#-0.149460812000000E+03|0.680022380000000E+02|
#-0.149506561000000E+03|0.680019960000000E+02|
it loads the correct values into the respective fields:
SQL> select * from poly_4pt where anrc = '00590';
ST ANRC GID
GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
02 00590 9
SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARR
AY(-144.47165, 61.6139949, -148.80311, 63.649898, -148.78899, 63.649597, -148.78
899, 63.649597, -148.66386, 63.647044, -148.42804, 63.649307, -148.42155, 63.503
If I add the '8307' SRID to the data syntax thusly ('8307' now follows SDO_GTYPE):
02|03950|1|2003|8307|1|1003|1|/
#-0.153395741022000E+03|0.679530269228395E+02|
#-0.149460812000000E+03|0.680022380000000E+02|
#-0.149506561000000E+03|0.680019960000000E+02|
The data doesn't get loaded into the proper fields. The '8307' SRID becomes part of SDO_ELEM_INFO instead of SDO_SRID even though it seems that it should load correctly the way I have it formatted.
SQL> select * from poly_4pt where anrc = '00590';
ST ANRC GID
GEOMETRY(SDO_GTYPE, SDO_SRID, SDO_POINT(X, Y, Z), SDO_ELEM_INFO, SDO_ORDINATES)
02 00590 9
SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(8307, 1, 1003, 1), SDO_ORDINATE_ARRAY(-144.47165, 61.6139949, -148.80311, 63.649898, -148.78899, 63.649597, -
148.78899, 63.649597, -148.66386, 63.647044, -148.42804, 63.649307, -148.42155,
63.503574, -148.41974, 63.462892, -148.41658, 63.391985, -148.36345, 63.391998,
So the real problem is that I don't understand what sqlldr is doing and therefore don't understand where I should position the '8307' SRID value in the data flow in order for it to be loaded into the correct field. I guess I am "object-relational data load challenged"!
Thank you for your continued assistance.

Similar Messages

  • How to create a polygon with the Lat/Long Coordinates

    I have set of Lat/Long coordinates and I need to create a polygon geofence. Can any of you know how to do this please share your thoughts with me
    I have the following coordinates
    -84.3087, 39.3465; -84.3118904, 39.3306296; -84.3265158, 39.3372422; -84.2866, 39.3371; -84.2958, 39.3284; -84.2888, 39.3241
    Thanks

    Assuming these are long/lat values, the polygon can be defined as:
    sdo_geometry(2003, 8307, null, sdo_elem_info_array(1, 1003, 1),
    sdo_ordinate_array(-84.3087, 39.3465, -84.3118904, 39.3306296, -84.3265158, 39.3372422, -84.2866, 39.3371,
    -84.2958, 39.3284, -84.2888, 39.3241, -84.3087, 39.3465))
    siva

  • Select data with SDO_RELATE in lat long coordinate system(8307) in 10gR2

    Hi all,
    I have problem with selecting data from table.
    Data are in lat lon coordinate system 8307.
    These requests don't return any data:
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_FILTER(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,1),sdo_ordinate_array(-180,-90, 180,-90, 180,90, -180,90, -180,-90)) ) = 'TRUE';
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_RELATE(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,1),sdo_ordinate_array(-180,-90, 180,-90, 180,90, -180,90, -180,-90)), 'MASK=ANYINTERACT' ) = 'TRUE'
    Optimized polygon does return all data correctly:
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_FILTER(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,3),sdo_ordinate_array (-180,-90,180,90)) ) = 'TRUE'
    Smaller polygon select data correctly too.
    SELECT ISSUE_ID FROM MAP_ISSUES WHERE SDO_FILTER(GEOMETRY, sdo_geometry (2003, 8307, null, sdo_elem_info_array (1,1003,1),sdo_ordinate_array (52,-7, 54,-7 , 54,-5 , 52,-5, 52,-7)) ) = 'TRUE'
    I have tried changed polygon to be clockwise, counter clockwise, make the area a bit smaller( 160 instead of 180, 89 instead of 90) nothing has helped.
    My explanation than was, that Earth is sphere and each defined polygon defines TWO polygons in the sphere and there is convention that the smaller is chosen to select data. It would make sense along the previous results, but than I found one post which says that this is bug http://www.frontoracle.com/oracle-database/703/180703-size-of-are-of-interest-smaller-equals.html
    I have found in other thread that max only 1/2 of Earth could be selected Different results using SDO_RELATE with polygon and rectangle type but it seems not true, because optimized bounding box works fine!
    What is right? Is there anything in official documentation?
    Is it bug.
    Max 1/2 of Earth could be selected in one request.
    Each polygon defines two areas in the Earth and the smaller one is used to do spatial SDO_RELATE operation?
    Thanks!
    Regards,
    Zdenek

    Zdenek,
    A bug, or limititation, whichever you choose. IMHO if you ask for something, and don't get what you expect, it is a bug that could be fixed.
    But for 10g anywho, the following applies, which is why I choose 120 degree breaks for my code as it is less than 180...
    The following size limits apply with geodetic data:
    ■ No polygon element can have an area larger than one-half the surface of the Earth.
    ■ In a line, the distance between two adjacent coordinates cannot be greater than or
    equal to one-half the perimeter (a great circle) of the Earth.
    If you need to work with larger elements, first break these elements into multiple
    smaller elements and work with them. For example, you cannot create a geometry
    representing the entire ocean surface of the Earth; however, you can create multiple
    geometries, each representing part of the overall ocean surface. To work with a line
    string that is greater than or equal to one-half the perimeter of the Earth, you can add
    one or more intermediate points on the line so that all adjacent coordinates are less
    than one-half the perimeter of the Earth.
    Bryan

  • Calculating distance between lat long coordinates best possible way?

    Hi,
    Am proposing to have a table A with latitude and longitude values along with some other info for that lat lon in it. The number of rows of data will be more and it will be growing day by day. i am having one application which will provide a latitude and longitude value and this i have to compare with all the lat lon of the table A and fetch the nearest (distance wise) information from other columns corresponding to that lat long in table A.
    what is the best method available to implement this so as to reduce the time required to compare lat lon supplied with all rows of data in table A.
    Thanks in advance.

    Have a look at the spatial option from oracle. Also there is a forum dedicated to this type of questions.
    http://www.oracle.com/technetwork/database/options/spatial/index.html
    especially: http://download.oracle.com/otndocs/products/spatial/pdf/locator11g_feature_overview.pdf
    Edited by: Sven W. on Nov 30, 2010 5:53 PM

  • How to create a circle object with center(lat/long) and radius(kilo)?

    Hi
    I want to create a circle in my table, the data I have are the coordinate of center(lat/long) and the radius of the circle. The srid of the table is lat/long.
    Did I have to use some fomula to compute the coordinate of three points on the circle? If it's true, is there any example procedure you can show me?
    Thanks
    Lannie

    When a circle is created using SDO_BUFFER in geodetic space,
    the result is a circle with stroked arcs (as in arc_densify function).
    So the result from SDO_BUFFER will be a valid polygon without arcs,
    but approximate circle with straight lines.
    For example, in the example given by Dan, this is what you get:
    SDO_GEOMETRY(2003, 8307, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1), SDO_ORDINATE_ARRAY(-120, 42.09003, -120.03128, 42.086958, -120.06042, 42.0779524, -120.08543, 42.0636292, -120.1046, 42.0449675, -120.11663, 42.0232424, -120.1207, 41.9999365,
    -120.11654, 41.9766391, -120.10445, 41.9549369, -120.08526, 41.9363067, -120.06028, 41.9220148, -120.0312, 41.9130321, -120, 41.9099686, -119.9688, 41.9130321,
    -119.93972, 41.9220148, -119.91474, 41.9363067, -119.89555, 41.9549369, -119.88346, 41.9766391, -119.8793, 41.9999365, -119.88337, 42.0232424, -119.8954, 42.0449675, -119.91457, 42.0636292, -119.93958, 42.0779524, -119.96872, 42.086958, -120, 42.09003))
    siva

  • Convert LAT/LONG to X/Y

    Hello all,
    i've searched this forum to see how I can convert LAT/LONG values to XY coordinates.
    I've found this:
    SELECT
    sdo_geometry(2001, 8307, null, sdo_elem_info_array(1, 1003, 1),
    sdo_ordinate_array(52.849497, 5.723975, 52.883151, 5.999025))
    FROM DUAL
    I thought that when i executed this query, i'd see 2 values. But i was wrong.
    Is there a function that will return the XY when I give the LAT/LONG values ???

    You geometry does not validate (sdo_geom.validate_geometry(...) ,gtype and etype don't match!). You used a gtype 2001 (point) but in your elem_info_array (etype 1003) is an exterior polygonal ring. You need to fix your geometry first.
    When you said you want to converting lat/long to X/Y did you mean to convert a lat/long to a point (x,Y) in a projected coordinate system? If so, you can convert the geodetic geometry to a projected geometry(sdo_cs.transform), then use the SDO_UTIL.GETVERTICES function to retrieve all points in their order.
    From oracle spatial manual :
    SDO_CS.TRANSFORM(
    geom IN MDSYS.SDO_GEOMETRY,
    to_srid IN NUMBER
    ) RETURN MDSYS.SDO_GEOMETRY;
    SDO_UTIL.GETVERTICES
    Format
    SDO_UTIL.GETVERTICES(
    geometry IN SDO_GEOMETRY
    ) RETURN VERTEX_SET_TYPE;
    Description
    Returns the coordinates of the vertices of the input geometry.
    Parameters
    geometry
    Geometry for which to return the coordinates of the vertices.
    Usage Notes
    This function returns an object of VERTEX_SET_TYPE, which consists of a table of objects of VERTEX_TYPE. Oracle Spatial defines the type VERTEX_SET_TYPE as:
    CREATE TYPE vertex_set_type as TABLE OF vertex_type;
    Oracle Spatial defines the object type VERTEX_TYPE as:
    CREATE TYPE vertex_type AS OBJECT
    (x NUMBER,
    y NUMBER,
    z NUMBER,
    w NUMBER,
    id NUMBER);
    This function can be useful in finding a vertex that is causing a geometry to be invalid. For example, if you have identified a geometry as invalid by using the SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT function or the SDO_GEOM.VALIDATE_LAYER_WITH_CONTEXT procedure (both of which are documented in Chapter 15), you can use the GETVERTICES function to view the vertices in tabular format.
    Examples
    The following example returns the X and Y coordinates and ID values of the vertices of the geometries in the SHAPE column of the COLA_MARKETS table. (The example uses the definitions and data from Section 2.1.)
    SELECT c.mkt_id, c.name, t.X, t.Y, t.id
    FROM cola_markets c,
    TABLE(SDO_UTIL.GETVERTICES(c.shape)) t
    ORDER BY c.mkt_id, t.id;
    MKT_ID NAME X Y ID
    1 cola_a 1 1 1
    1 cola_a 5 7 2
    2 cola_b 5 1 1
    2 cola_b 8 1 2
    2 cola_b 8 6 3
    2 cola_b 5 7 4
    2 cola_b 5 1 5
    3 cola_c 3 3 1
    3 cola_c 6 3 2
    3 cola_c 6 5 3
    3 cola_c 4 5 4
    3 cola_c 3 3 5
    4 cola_d 8 7 1
    4 cola_d 10 9 2
    4 cola_d 8 11 3
    15 rows selected.

  • Cannot submit route requests using lat/long  to Oracle RouteServer

    I have version 10g of Oracle RouteServer running under OAS, and a backend 10g database loaded with some NAVTEQ data. The route server handles ordinary requests with un-geocoded addresses -- most of the time. Whenever I attempt a route request using latitude and longitude, even using the sample requests at http://<myhost>/routeserver/route_requests/lat_long.html, I get the following response:
    <RouteServerException>
    [RSE-0206: Unexpected output format from Geocoder!!!]
    </RouteServerException>.
    What does this mean? How can the Oracle-provided sample request fail?

    Here's the XML for the original lat/long routing request to the Oracle RouteServer.
    <?xml version="1.0" standalone="yes"?>
    <route_request id="8"
    route_preference="shortest"
    road_preference="highway"
    return_driving_directions="true"
    distance_unit="meter"
    time_unit="second"
    return_route_geometry="true">
    <start_location>
    <input_location id="1" longitude="-122.39382" latitude="37.79518" />
    </start_location>
    <end_location>
    <input_location id="2" longitude="-122.4054826" latitude="37.7423566" />
    </end_location>
    </route_request>
    When I run a reverse geocoding query using the input location coordinates in the underlying database with
    SELECT SDO_GCDR.REVERSE_GEOCODE('ODFUSER',
    SDO_GEOMETRY(2001, 8307,
    SDO_POINT_TYPE(-122.39382, 37.79518, NULL), NULL, NULL),
    'US') FROM DUAL
    and
    SELECT SDO_GCDR.REVERSE_GEOCODE('ODFUSER',
    SDO_GEOMETRY(2001, 8307,
    SDO_POINT_TYPE(-122.4054826, 37.7423566, NULL), NULL, NULL),
    'US') FROM DUAL
    I get
    SDO_GEO_ADDR(0, SDO_KEYWORDARRAY(), NULL, 'THE EMBARCADERO', NULL, NULL, 'SAN FRANCISCO BAY AREA', 'SAN FRANCISCO', 'CA', 'US', '94111', NULL, '94111', NULL, NULL, 'THE EMBARCADERO', NULL, 'F', 'F', NULL, NULL, 'R', 1, 916027581, '', 1, 'DEFAULT', -122.39382, 37.79518, '????1141114??404?')
    and
    SDO_GEO_ADDR(0, SDO_KEYWORDARRAY(), NULL, 'FLOWER ST', NULL, NULL, 'SAN FRANCISCO', 'SAN FRANCISCO', 'CA', 'US', '94124', NULL, '94124', NULL, '21', 'FLOWER', 'ST', 'F', 'F', NULL, NULL, 'L', .596104898, 199223581, '', 1, 'DEFAULT', -122.40546, 37.7424313, '????4141414??404?')
    respectively. I'm fairly novice at reading this, but it appears that the reverse geocoding was successful. That makes it all the more puzzling as to why the routeserver, using the same data source, returns the following (in my browser window - IE7, FF 3.0.12, Chrome 2.0.172.33):
    <RouteServerException>
    [RSE-0206: Unexpected output format from Geocoder!!!]
    </RouteServerException>
    By the way, the database version is 10g Enterprise Edition Release 10.2.0.4.0.
    Edited by: lowlyscrub on Jul 23, 2009 11:21 AM

  • Newbie: Earth Centered Earth Fixed - Lat/Long Conversion, can it be done w/ Spatial?

    This is an information request from a complete coordinate systems newbie:
    1. Does Oracle Spatial in 9.0.1 have an entry in MDSYS.CS_SRS that
    corresponds to the coordinate system commonly known as "Earth Centered, Earth
    Fixed" - where would I look (besides the table itself - I already tried that
    with the 8.1.7 EE to no avail - it may be because I don't know enough about how
    coordinate systems are referenced (the common nomenclature used) and just
    didn't recognize it when I saw it.)
    2. Are there any existing pl/sql snippets of code that can handle coordinate
    conversions between ECEF-Lat/Long, geodetic degrees-decimal degrees? (If yes,
    where should I go to look for them? By the way, please, please say yes, there
    are many such packages just like there are for unit conversions (like binary to
    hex).)
    3. Where should I look to get information on a product called Map Viewer which
    was mentioned in the latest edition of Oracle Magazine (May/June 2002, p.25 -
    it was said to be a part of the 9iAS suite of products - I looked all over the
    documentation but didn't find any mention of it.)
    Thank you very much for your time and attention!
    Julien

    This is an information request from a complete coordinate systems newbie:
    1. Does Oracle Spatial in 9.0.1 have an entry in MDSYS.CS_SRS that
    corresponds to the coordinate system commonly known as "Earth Centered, Earth
    Fixed" - where would I look (besides the table itself - I already tried that
    with the 8.1.7 EE to no avail - it may be because I don't know enough about how
    coordinate systems are referenced (the common nomenclature used) and just
    didn't recognize it when I saw it.)
    2. Are there any existing pl/sql snippets of code that can handle coordinate
    conversions between ECEF-Lat/Long, geodetic degrees-decimal degrees? (If yes,
    where should I go to look for them? By the way, please, please say yes, there
    are many such packages just like there are for unit conversions (like binary to
    hex).)You can get the proper params from the EPSG <http://www.epsg.org>,
    I recall seeing some coord conversion samples in the tutorials/sample code - look in the OTN library
    MArk

  • How to get GML data in LAT/LONG format rather than LONG/LAT format

    I want to generate GML from my spatial data but sdo_util.to_Gmlgeometry extracts data in LONG/LAT format where as I need it in LAT/LONG format.
    Is there an easy way to extract data in LAT/LONG format otehr than parsing the gml and then switching the Lat and long.

    Hi,
    I think it would have to do how you store your geometries, you might need a transformation before, notice the srsName from the resulting query:
    SELECT TO_CHAR(SDO_UTIL.TO_GMLGEOMETRY(MDSYS.SDO_GEOMETRY(2001, 8307, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1), MDSYS.SDO_ORDINATE_ARRAY(170.5,-43.5))))
    from dual
    -- Result:
    <gml:Point srsName="SDO:8307" xmlns:gml="http://www.opengis.net/gml"><gml:coordinates decimal="." cs="," ts=" ">170.5,-43.5 </gml:coordinates></gml:Point>
    So without a transformation I would say it would be hard to get:
    http://trac.osgeo.org/gdal/wiki/rfc20_srs_axes
    If I come across a simple solution (without some fancy manipulation of the ordinates on a custom function/package) I will post it.
    Cheers

  • Does Spatial support "Earth Centered, Earth Fixed" to Lat/Long conversion?

    Does Spatial support "Earth Centered, Earth Fixed" to Lat/Long conversion? I've looked in coordinate list table but don't see "ECEF" (or anything that might by a synonym for ECEF) listed.
    Thanks,
    Julien

    Spatial does not support ECEF coordinates at this time, nor conversions to/from longitude, latitude, and height above the ellipsoid. It is possible that Spatial will support ECEF in a future release of the product.

  • Dist between two lat/long's in USA

    Hello,
    Can anyone please give me the function(Oracle or some other function) to find the distance between two points(Both of them are in lat/longs). Both the points are within the boundary of US.
    Thanks,

    Hi,
    In Oracle 8.1.6, we have Beta support
    for Coordinate Systems. There is
    Beta users guide available under PRODUCTS/SPATIAL.
    With this functionality, you can calculate
    the distance between two points
    very accuratly.
    Here is an example. I will go into details
    below. Hope this helps. Thanks.
    Dan
    ======
    SAMPLE SQL: (sorry about the formatting)
    select
    mdsys.sdo_geom.sdo_length (
    mdsys.sdo_cs.transform (
    mdsys.sdo_geometry (2002, 8307, null,
    mdsys.sdo_elem_info_array (1,2,1),
    mdsys.sdo_ordinate_array (
    -73.983014309,
    40.749544981,
    a.geometry.sdo_point.x,
    a.geometry.sdo_point.y)),
    MDSYS.SDO_DIM_ARRAY(
    MDSYS.SDO_DIM_ELEMENT(
    'X', -180, 180, .00000005),
    MDSYS.SDO_DIM_ELEMENT(
    'Y', -90, 90, .00000005)),
    41004),
    .00000005) * 6.213712e-04 DISTANCE_IN_MILES
    from test_abi a
    where
    mdsys.sdo_nn (
    a.geometry,
    mdsys.sdo_geometry (
    1, 8307,
    mdsys.sdo_point_type (-73.983014309,
    40.749544981,
    null),
    null, null),
    'SDO_NUM_RES = 1') = 'TRUE';
    DESCRIPTION:
    ============
    1) The above query is returning the
    nearest point to
    (-73.983014309, 40.749544981)
    and also returning the distance in miles.
    TEST_ABI.geometry is stored in
    longitude/latitude with 8307
    as the SRID.
    Note, if you set the SRID in the
    SDO_GEOMETRY object, you must also
    set the SRID in USER_SDO_GEOM_METADATA.
    To find out more info on SRID 8307,
    you can execute the following:
    select wktext
    from mdsys.cs_srs
    where srid = 8307;
    SDO_NN is the operator used to find
    the nearest neighbor.
    For nearest neighbor queries, you
    may want to try using RTREE indexes,
    also Beta in 8.1.6.
    To create an RTREE index, omit
    SDO_LEVEL and SDO_NUMTILES from
    the create index statement of your
    spatial index.
    We plan to fully profile RTREE indexes
    in 8.1.7 and recommend them when
    appropriate. Nearest neighbor is an
    excellent candidate for an RTREE index.
    2) In the SELECT clause, we are calling
    two functions:
    SDO_LENGTH
    SDO_CS.TRANSFORM
    The first argument passed into SDO_LENGTH
    is the return value from
    CS_TRANSFORM (which will be a
    projected SDO_GEOMETRY object).
    The second argument to SDO_LENGTH
    is an SDO_TOLERANCE.
    3) The first argument to CS_TRANSFORM
    is an SDO_GEOMETRY constructor for a
    line string, where the first point of
    the linestring is
    (-73.983014309, 40.749544981),
    and the second point is the nearest
    neighbor resulting from SDO_NN.
    This goal here is to project the
    linestring so we can get an accurate
    result from SDO_LENGTH.
    The second argument to CS_TRANSFORM
    a dim_array.
    The third argument to CS_TRANSFORM
    is the target SRID. In this example,
    SRID 41004 is used. This will be
    fairly accurate for the continental US.
    The geometry constructor for the
    linestring will be projected to
    SRID 41004.
    If more accurate results are desired,
    you should use an SRID that corresponds
    to a specific state plane projection.
    Query the WKTEXT column in MDSYS.CS_SRS
    to pick appropriate SRID's for projection.
    i.e. If I knew my nearest neighbor result
    is going to be in Georgia, I might
    use SRID 1001 instead of 41004.
    4) In the result of the select list, I am
    multiplying by 6.213712e-04,
    the conversion factor from meters to
    miles.
    Hope this helps. Thanks.
    Dan

  • Accurate distance between points, lat/long to miles?

    Hi,
    I have a bunch of points as lat/long data in SRID 8307 format. From reading this forum, I understand than in Oracle 8.1.7 to get accurate distances I need to transform these points into a cartesian coordinate system.
    My data is US-based, so I am using SRID 32775 in a command like the following:
    EXECUTE SDO_CS.TRANSFORM_LAYER('restaurant_locations', 'location', 'restaurant_locations_32775', 32775);
    This creates a new table with new point geometries and a rowid that I assume points back to the original 8307 table.
    I've tried creating an index on the new table with cartesian coordinates, but I get this error:
    CREATE INDEX restaurant_csp_idx
    ON restaurant_locations_32775(geometry)
    INDEXTYPE IS MDSYS.SPATIAL_INDEX
    PARAMETERS('SDO_LEVEL=9 sdo_commit_interval=1000 layer_gtype=POINT' );
    2 3 4 CREATE INDEX restaurant_csp_idx
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13200: internal error [POINT] in spatial indexing.
    ORA-29400: data cartridge error
    ORA-13003: the specified range for a dimension is invalid
    ORA-06512: at "MDSYS.MD", line 1673
    ORA-06512: at line 1
    ORA-13003: the specified range for a dimension is invalid
    ORA-06512: at "MDSYS.MD", line 1673
    ORA-06512: at line 1
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD", line 8
    ORA-06512: at line 1
    Here's the entry for the 32775-transformed points in the metadata table:
    INSERT INTO USER_SDO_GEOM_METADATA
    VALUES (
    'restaurant_locations_32775',
    'geometry',
    MDSYS.SDO_DIM_ARRAY( -- 20X20 grid, virtually zero tolerance
    MDSYS.SDO_DIM_ELEMENT('X', 1951908.05, 16230214.8, 0.005),
    MDSYS.SDO_DIM_ELEMENT('Y', -6858801, 13168375.5, 0.005)
    32775 -- SRID (reserved for future Spatial releases)
    My questions are;
    Do I need to build a new spatial index? It seems like once I transform the lat/long data to cartesian I need to build a new index as well ( on the 32775-transformed table ).
    Is this the best way to approach distance queries with lat/long data? It seems like a lot of work, plus the second index and table really add to the overhead if a location changes.
    Any ideas on why I can't build an index on the output table from my SDO_CS.TRANSFORM_LAYER() call? I used SDO_TUNE.ESTIMATE_TILING_LEVEL() and SDO_GEOM.VALIDATE_GEOMETRY() and got no complaints. I'm at a loss.
    I also can't seem to get set autotrace to work. It works fine for any non-spatial query, but if I try to trace a spatial query, I get this error:
    SQL> SELECT /*+ INDEX(restaurant_locations restaurant_sp_idx) */ r_a.restaurant_id
    FROM restaurant_locations r_a, restaurant_locations r_b, user_sdo_geom_metadata m
    WHERE r_b.restaurant_id != r_a.restaurant_id
    AND SDO_GEOM.WITHIN_DISTANCE(r_a.location, m.diminfo, 1, r_b.location, m.diminfo) = 'TRUE'
    AND r_b.restaurant_id = '5999';
    2 3 4 5
    RESTAURANT_ID
    456999
    456999
    Execution Plan
    ERROR:
    ORA-01031: insufficient privileges
    SP2-0612: Error generating AUTOTRACE EXPLAIN report
    Statistics
    49 recursive calls
    28 db block gets
    83 consistent gets
    0 physical reads
    0 redo size
    415 bytes sent via SQL*Net to client
    425 bytes received via SQL*Net from client
    2 SQL*Net roundtrips to/from client
    11 sorts (memory)
    0 sorts (disk)
    2 rows processed
    I've looked at the arraysize, and I've made sure to run the trace-enabling sql and granted plustrace to my DB user.
    Thanks for any help,
    _jason                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Jason,
    The error on the index create is likely due to data being outside the bounds of the coordinate system as specified in user_sdo_geom_metadata.
    If the data is stored in the point field then you can check the bounds by doing queries like the following, altering them for your table/column name (my table is cities_test, the geometry column name is location):
    SQL> select min(a.location.sdo_point.x) from cities_test a;
    MIN(A.LOCATION.SDO_POINT.X)
    -157.80423
    SQL> select max(a.location.sdo_point.x) from cities_test a;
    MAX(A.LOCATION.SDO_POINT.X)
    -71.017892
    SQL> select max(a.location.sdo_point.y) from cities_test a;
    MAX(A.LOCATION.SDO_POINT.Y)
    61.178368
    SQL> select min(a.location.sdo_point.y) from cities_test a;
    MIN(A.LOCATION.SDO_POINT.Y)
    21.31725
    Do you need to build a spatial index?
    Only if you are going to use spatial operators such as sdo_filter, sdo_relate, sdo_within_distance, and sdo_nn. If you have no requirements for these operators, then there is no reason to build a spatial index. From the trace query at the end of the posting, I suspect that you will need to have a spatial index.
    Is this the best approach? Maybe, it depends on what your requirements are. If the data is static and performance is your highest priority, then maybe it is. If you have a requirement for a spatial index, then certainly it is. If you are only getting the distance between a few few known geometries, and you don't care about the time it takes to convert data on the fly, then you can use the sdo_cs.transform function within the sdo_geom.sdo_distance function to convert both geometries to the equal area projection.
    The validation routines should have caught this - I checked and they do not for 8.1.7, and they do for 9i.
    Regarding the set autotrace command, I'm not sure why it isn't working for you. It works for my generic scott/tiger account from a typical install.
    hope some of this is useful.
    dan
    null

  • Manual Lat Long Entry?

    Does anyone know the format to enter Lat Long data manually to a photo. I have a photo, I have the lat long I want associated with it (middle of ocean, so no reference) I have clicked on "Find...." field, brought up Google Map, but can't find a Lat Long format it will accept.
    Thanks for any help.

    I've not used it but it has been reported that inputting the decimal values into the google place search window works
    After a comment in Tidbits about the iMovie 8.0.1 update adding lat/long support (http://db.tidbits.com/article/10173), I tried it in iPhoto 8.0.2 and it appears to work fine.
    1) Click on the photo's to open the places pane
    2) Enter the coordinates (in my case 36.1533, -47.4266 which is in the North Atlantic)
    3) When it says Find "36.1533, -47.4266" on a map click the search icon
    4) It shows it on a map (usually zoomed in too far to have any map data) and you can rename the location if you wish and assign it to the photo.
    It appears to export to jpg's fine (according to Preview).
    Nice add for an anonymous update (if it is indeed new)
    LN

  • Using lat long with imaq axis matching

    I am having trouble associating the lat long values with the imaq image extent, firstly the imaq has an indirect coordinate reference with y axis icreasing top to bottom which is reverse to latitude values. Secoundly, I am unable to change the value of origion to any value other then (0,0). Can anybody help me or provide any guidence in this reard...
    Solved!
    Go to Solution.

    Hi Amir13,
    I would suggest you post this to the machine vision forum, http://forums.ni.com/t5/Machine-Vision/bd-p/200 , I think you'll get a better response there.  After you do that, could you please post a link to the new post here so user Sets can find it?
    Also, when you make your new post, please attach an example VI and/or picture of what you're trying to accomplish.  Sometimes this can help describe the issue in more detail than text can.
    Thanks,
    Bobby Breyer
    Applications Engineer
    National Instruments

  • HT1551 When I go to NetFlix, it opens to all the shows, but when I presss play, it comes up with an error saying it cannot load, try later.  This continues everytime on NetFlix

    Why does NetFlix not play on Apple TV when I click on the feature I want to watch?  Why does it alway come up as an error, not loading, try later?

    Do this: http://appletv2.com/fix-netflix-apple-tv/

Maybe you are looking for