Hi,

 should be fixed in r13953 (rolling updates).

$ ./test_geo.php -a arcgis '1313 disneyland dr anaheim, ca'
+--------------------------------+
| Location                       |
+--------------------------------+
| 1313 disneyland dr anaheim, ca |
+--------------------------------+

+----------+------------+--------------+---------------+------------+--------+---------+-------+
| Geo: API | Lat        | Lon          | Country       | State      |
County | City    | Error |
+----------+------------+--------------+---------------+------------+--------+---------+-------+
| arcgis   | 33.8144249 | -117.9249177 | United States | California |
Orange | Anaheim |       |
+----------+------------+--------------+---------------+------------+--------+---------+-------+

Stephen Kent via observium wrote on 17.03.2025 13:52:
>
>  
>
>  
>
> I noticed when adding geolocation info to devices, I would
> consistently get incorrect data regardless of address format for
> ArcGIS in Observium and when using the test_geo.php script.
> Specifically, the United States address’s “State”.
>
>  
>
> My preferred format is the NeDi hierarchical format
> <https://www.nedi.ch/documentation/index.html> (US;CA;Anaheim,1234
> Main Street;2nd Floor;Server Room). Even using a typical format, info
> is incorrect. (1234 Main Street, Anaheim,CA)
>
>  
>
> I suspect ArcGIS is returning the correct info, but the php is
> stuffing the data in the wrong fields. I don’t know php enough to
> confirm.
>
>  
>
> So below is a query using typical US address format.
>
>  
>
>  
>
> /opt/observium# ./test_geo.php -a arcgis '1313 disneyland dr anaheim, ca'
>
> +--------------------------------+
>
> | Location                       |
>
> +--------------------------------+
>
> | 1313 disneyland dr anaheim, ca |
>
> +--------------------------------+
>
>  
>
> +----------+------------+--------------+---------------+------------+--------+---------+-------+
>
> | Geo: API | Lat        | Lon          | Country       | State      |
> County | City    | Error |
>
> +----------+------------+--------------+---------------+------------+--------+---------+-------+
>
> | arcgis   | 33.8144249 | -117.9249177 | United States | Disneyland |
> Orange | Anaheim |       |
>
> +----------+------------+--------------+---------------+------------+--------+---------+-------+
>
>  
>
> And in NeDi format:
>
>  
>
> /opt/observium# ./test_geo.php -a arcgis 'US;CA;1313 Disneyland
> Drive;Building 1'
>
> +----------------------------------------+
>
> | Location                               |
>
> +----------------------------------------+
>
> | US;CA;1313 Disneyland Drive;Building 1 |
>
> +----------------------------------------+
>
>  
>
> +----------+------------+--------------+---------------+------------+--------+---------+-------+
>
> | Geo: API | Lat        | Lon          | Country       | State      |
> County | City    | Error |
>
> +----------+------------+--------------+---------------+------------+--------+---------+-------+
>
> | arcgis   | 33.8144249 | -117.9249177 | United States | Disneyland |
> Orange | Anaheim |       |
>
> +----------+------------+--------------+---------------+------------+--------+---------+-------+
>
>  
>
>  
>
> All fields other then “State” is correct.
>
>  
>
> When you run the test-geo.php in debug, we get a lot of info, but I
> want to point out this section:
>
> I think this is the json formatted return from ArcGIS. All this data
> looks correct. In particular, notice the field descriptor “StName”
> with value “Disneyland”.
>
> I think this is where to disconnect occurs. I think there was a
> misunderstanding that “StName” was the “State” value, while it is
> actually returned in “Region” (California)
>
> I think “StName” is the street name (Disneyland).
>
>  
>
> So the solution would be for the php to stuff the “State” field with
> the value from “Region”. Not sure what Observium is doing with Street
> name.
>
>  
>
>  
>
> /opt/observium# ./test_geo.php -dd -a arcgis '1313 disneyland dr
> anaheim, ca'
>
> DEBUG!
>
> Load class 'Console_Color2' from
> '/opt/observium/libs/pear/Console/Color2.php': OK
>
> DEBUG: is_cli() == TRUE, PHP_SAPI: 'cli', REMOTE_ADDR: ''DEFINITIONS
> Time  : 0.0343442 ms
>
>  
>
>  
>
> REQUEST[https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?SingleLine=1313+disneyland+dr+anaheimC+ca&outFields=CountryCRegionCTerritoryCStNameCSubregionCCityCPlaceNameCTypeCScore&f=json&langCode=en&maxLocations=1]
>
> REQUEST STATUS[TRUE]
>
> REQUEST RUNTIME[0.4547s]
>
> RESPONSE CODE[200 OK]
>
> RESPONSE[
>
> {"spatialReference":{"wkid":4326,"latestWkid":4326},"candidates":[{"address":"1313
> S Disneyland Dr, Anaheim, California,
> 92802","location":{"x":-117.924917739781,"y":33.814424874175},"score":99.5,"attributes":{"Score":99.5,"Type":"","PlaceName":"","StName":"Disneyland","City":"Anaheim","Subregion":"Orange
> County","Region":"California","Territory":"","Country":"USA"},"extent":{"xmin":-117.925917739781,"ymin":33.813424874175,"xmax":-117.923917739781,"ymax":33.815424874175}}]}
>
> ]
>
>  
>
> > $http_response_header /opt/observium/includes/http.inc.php:195
>
> null
>
> TRUE
>
> Response [4326] valid: [spatialReference->wkid] regex [^\d+$]
>
>  
>
>  
>
>   /opt/observium/includes/http.inc.php:691
>
> array(
>
>   [spatialReference] => array(
>
>                           [wkid]       => int(4326)
>
>                           [latestWkid] => int(4326)
>
>                         )
>
>   [candidates]       => array(
>
>                           [0] => array(
>
>                                    [address]    => string(48) "1313 S
> Disneyland Dr, Anaheim, California, 92802"
>
>                                    [location]   => array(
>
>                                                      [x] =>
> double(-117.92491773978)
>
>                                                      [y] =>
> double(33.814424874175)
>
>                                                    )
>
>                                    [score]      => double(99.5)
>
>                                    [attributes] => array(
>
>                                                      [Score]     =>
> double(99.5)
>
>                                                      [Type]      =>
> string(0) ""
>
>                                                      [PlaceName] =>
> string(0) ""
>
>                                                      [StName]    =>
> string(10) "Disneyland"
>
>                                                      [City]      =>
> string(7) "Anaheim"
>
>                                                      [Subregion] =>
> string(13) "Orange County"
>
>                                                      [Region]    =>
> string(10) "California"
>
>                                                      [Territory] =>
> string(0) ""
>
>                                                      [Country]   =>
> string(3) "USA"
>
>                                                    )
>
>                                    [extent]     => array(
>
>                                                      [xmin] =>
> double(-117.92591773978)
>
>                                                      [ymin] =>
> double(33.813424874175)
>
>                                                      [xmax] =>
> double(-117.92391773978)
>
>                                                      [ymax] =>
> double(33.815424874175)
>
>                                                    )
>
>                                  )
>
>                         )
>
> )
>
>  
>
> …
>
>  
>
> > $location /opt/observium/test_geo.php:88
>
> array(
>
>   [location]         => string(30) "1313 disneyland dr anaheim, ca"
>
>   [location_geoapi]  => string(6) "arcgis"
>
>   [location_lat]     => double(33.8144249)
>
>   [location_lon]     => double(-117.9249177)
>
>   [location_city]    => string(7) "Anaheim"
>
>   [location_county]  => string(6) "Orange"
>
>   [location_state]   => string(10) "Disneyland"
>
>   [location_country] => string(13) "United States"
>
>   [location_status]  => string(315) "Geocoding ENABLED, try detect
> device coordinates:
>
>   by FORWARD query (API: ARCGIS, sysLocation: 1313 disneyland dr
> anaheim, ca) - FOUND
>
>   GEO API REQUEST:
>
>   GEO LOCATION: United States (Country), Disneyland (State), Orange
> (County), Anaheim (City)
>
>   GEO COORDINATES: 33.8144249 (Latitude), -117.9249177 (Longitude)"
>
> )
>
> +----------+------------+--------------+---------------+------------+--------+---------+-------+
>
> | Geo: API | Lat        | Lon          | Country       | State      |
> County | City    | Error |
>
> +----------+------------+--------------+---------------+------------+--------+---------+-------+
>
> | arcgis   | 33.8144249 | -117.9249177 | United States | Disneyland |
> Orange | Anaheim |       |
>
> +----------+------------+--------------+---------------+------------+--------+---------+-------+
>
>  
>
>  
>
>  
>
>  
>
> Observium       CE 24.12.13800 (24th December 2024)
>
> OS                Linux 5.15.0-131-generic [amd64] (Ubuntu 22.04)
>
> Apache           2.4.52 (Ubuntu)
>
> PHP              8.1.2-1ubuntu2.20 (OPcache: ENABLED) (Memory: 128MB)
>
> Python           3.10.12
>
> MySQL             8.0.41-0ubuntu0.22.04.1 (extension: mysqli
> 8.1.2-1ubuntu2.20)
>
> SNMP NET-SNMP   5.9.1
>
> RRDtool          1.7.2
>
> Fping            5.1 (IPv4 and IPv6)
>
> Fetch cURL       7.81.0 (OpenSSL/3.0.2, LibZ 1.2.11, LibIDN 2.3.2)
>
>
>
> _______________________________________________
> observium mailing list -- [email protected]
> To unsubscribe send an email to [email protected]

-- 
Mike Stupalov,
Discord channel: https://discord.gg/GjpNXKWm8W
Observium Limited, https://observium.org

_______________________________________________
observium mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to